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/utils/Caret.js | function (element, start, end) {
if ("selectionStart" in element) {
element.selectionStart = start;
element.selectionEnd = end;
} else {
var document = Aria.$window.document;
if (document.selection) {
var range = element.createTextRange();
range.moveStart('character', start);
range.moveEnd('character', -element.value.length + end);
range.select();
}
}
} | javascript | function (element, start, end) {
if ("selectionStart" in element) {
element.selectionStart = start;
element.selectionEnd = end;
} else {
var document = Aria.$window.document;
if (document.selection) {
var range = element.createTextRange();
range.moveStart('character', start);
range.moveEnd('character', -element.value.length + end);
range.select();
}
}
} | [
"function",
"(",
"element",
",",
"start",
",",
"end",
")",
"{",
"if",
"(",
"\"selectionStart\"",
"in",
"element",
")",
"{",
"element",
".",
"selectionStart",
"=",
"start",
";",
"element",
".",
"selectionEnd",
"=",
"end",
";",
"}",
"else",
"{",
"var",
"document",
"=",
"Aria",
".",
"$window",
".",
"document",
";",
"if",
"(",
"document",
".",
"selection",
")",
"{",
"var",
"range",
"=",
"element",
".",
"createTextRange",
"(",
")",
";",
"range",
".",
"moveStart",
"(",
"'character'",
",",
"start",
")",
";",
"range",
".",
"moveEnd",
"(",
"'character'",
",",
"-",
"element",
".",
"value",
".",
"length",
"+",
"end",
")",
";",
"range",
".",
"select",
"(",
")",
";",
"}",
"}",
"}"
]
| Set the caret position of the HTML element
@param {HTMLElement} element The html element
@param {Integer} start The starting caret position
@param {Integer} end The ending caret position | [
"Set",
"the",
"caret",
"position",
"of",
"the",
"HTML",
"element"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Caret.js#L63-L76 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Caret.js | function (element) {
var start = 0;
var end = (element.value.length) ? element.value.length : 0;
if (end) {
this.setPosition(element, start, end);
}
} | javascript | function (element) {
var start = 0;
var end = (element.value.length) ? element.value.length : 0;
if (end) {
this.setPosition(element, start, end);
}
} | [
"function",
"(",
"element",
")",
"{",
"var",
"start",
"=",
"0",
";",
"var",
"end",
"=",
"(",
"element",
".",
"value",
".",
"length",
")",
"?",
"element",
".",
"value",
".",
"length",
":",
"0",
";",
"if",
"(",
"end",
")",
"{",
"this",
".",
"setPosition",
"(",
"element",
",",
"start",
",",
"end",
")",
";",
"}",
"}"
]
| Select the element text setting the caret position to the whole input value.
@type {HTMLElement} element The html elment | [
"Select",
"the",
"element",
"text",
"setting",
"the",
"caret",
"position",
"to",
"the",
"whole",
"input",
"value",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Caret.js#L82-L88 | train |
|
ariatemplates/ariatemplates | src/aria/touch/Gesture.js | function () {
if (!this.eventsAlreadyAttached) {
this.body = Aria.$window.document.body;
var map = this._getInitialListenersList();
for (var i = 0; i < map.length; i++) {
this._addListener(map[i].evt, map[i].cb);
}
this.eventsAlreadyAttached = true;
}
} | javascript | function () {
if (!this.eventsAlreadyAttached) {
this.body = Aria.$window.document.body;
var map = this._getInitialListenersList();
for (var i = 0; i < map.length; i++) {
this._addListener(map[i].evt, map[i].cb);
}
this.eventsAlreadyAttached = true;
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"eventsAlreadyAttached",
")",
"{",
"this",
".",
"body",
"=",
"Aria",
".",
"$window",
".",
"document",
".",
"body",
";",
"var",
"map",
"=",
"this",
".",
"_getInitialListenersList",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"map",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"_addListener",
"(",
"map",
"[",
"i",
"]",
".",
"evt",
",",
"map",
"[",
"i",
"]",
".",
"cb",
")",
";",
"}",
"this",
".",
"eventsAlreadyAttached",
"=",
"true",
";",
"}",
"}"
]
| This method is called when AriaWindow sends an attachWindow event. It registers the initial listeners for the
gesture.
@private | [
"This",
"method",
"is",
"called",
"when",
"AriaWindow",
"sends",
"an",
"attachWindow",
"event",
".",
"It",
"registers",
"the",
"initial",
"listeners",
"for",
"the",
"gesture",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/Gesture.js#L86-L95 | train |
|
ariatemplates/ariatemplates | src/aria/touch/Gesture.js | function () {
var map = this._getInitialListenersList();
for (var i = 0; i < map.length; i++) {
this._removeListener(map[i].evt, map[i].cb);
}
this.eventsAlreadyAttached = false;
} | javascript | function () {
var map = this._getInitialListenersList();
for (var i = 0; i < map.length; i++) {
this._removeListener(map[i].evt, map[i].cb);
}
this.eventsAlreadyAttached = false;
} | [
"function",
"(",
")",
"{",
"var",
"map",
"=",
"this",
".",
"_getInitialListenersList",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"map",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"_removeListener",
"(",
"map",
"[",
"i",
"]",
".",
"evt",
",",
"map",
"[",
"i",
"]",
".",
"cb",
")",
";",
"}",
"this",
".",
"eventsAlreadyAttached",
"=",
"false",
";",
"}"
]
| This method is called when AriaWindow sends a detachWindow event. It unregisters the listeners added in
_connectTouchEvents.
@private | [
"This",
"method",
"is",
"called",
"when",
"AriaWindow",
"sends",
"a",
"detachWindow",
"event",
".",
"It",
"unregisters",
"the",
"listeners",
"added",
"in",
"_connectTouchEvents",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/Gesture.js#L102-L108 | train |
|
ariatemplates/ariatemplates | src/aria/touch/Gesture.js | function () {
var map = this._getAdditionalListenersList();
for (var i = 0; i < map.length; i++) {
this._addListener(map[i].evt, map[i].cb);
}
} | javascript | function () {
var map = this._getAdditionalListenersList();
for (var i = 0; i < map.length; i++) {
this._addListener(map[i].evt, map[i].cb);
}
} | [
"function",
"(",
")",
"{",
"var",
"map",
"=",
"this",
".",
"_getAdditionalListenersList",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"map",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"_addListener",
"(",
"map",
"[",
"i",
"]",
".",
"evt",
",",
"map",
"[",
"i",
"]",
".",
"cb",
")",
";",
"}",
"}"
]
| Registers the listeners added during the gesture lifecycle, once the gesture is started.
@private | [
"Registers",
"the",
"listeners",
"added",
"during",
"the",
"gesture",
"lifecycle",
"once",
"the",
"gesture",
"is",
"started",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/Gesture.js#L236-L241 | train |
|
ariatemplates/ariatemplates | src/aria/touch/Gesture.js | function () {
var map = this._getAdditionalListenersList();
for (var i = 0; i < map.length; i++) {
this._removeListener(map[i].evt, map[i].cb);
}
} | javascript | function () {
var map = this._getAdditionalListenersList();
for (var i = 0; i < map.length; i++) {
this._removeListener(map[i].evt, map[i].cb);
}
} | [
"function",
"(",
")",
"{",
"var",
"map",
"=",
"this",
".",
"_getAdditionalListenersList",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"map",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"_removeListener",
"(",
"map",
"[",
"i",
"]",
".",
"evt",
",",
"map",
"[",
"i",
"]",
".",
"cb",
")",
";",
"}",
"}"
]
| Unregisters the listeners added during the gesture lifecycle.
@private | [
"Unregisters",
"the",
"listeners",
"added",
"during",
"the",
"gesture",
"lifecycle",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/Gesture.js#L247-L252 | train |
|
ariatemplates/ariatemplates | src/aria/touch/Gesture.js | function (event, name, extraData) {
var target = (event.target) ? event.target : event.srcElement;
var fakeEvent = aria.DomEvent.getFakeEvent(name, target);
if (!event.returnValue) {
fakeEvent.preventDefault();
}
if (event.cancelBubble) {
fakeEvent.stopPropagation();
}
fakeEvent.pageX = event.pageX;
fakeEvent.pageY = event.pageY;
fakeEvent.clientX = event.clientX;
fakeEvent.clientY = event.clientY;
fakeEvent.touches = event.touches;
fakeEvent.changedTouches = event.changedTouches;
fakeEvent.isPrimary = event.isPrimary;
if (this.startData) {
if (this.startData.time) {
fakeEvent.duration = (new Date()).getTime() - this.startData.time;
}
}
if (!extraData) {
extraData = {};
}
extraData.startX = this.startData.positions[0].x;
extraData.startY = this.startData.positions[0].y;
var position = ariaTouchEvent.getPositions(event);
extraData.currentX = position[0].x;
extraData.currentY = position[0].y;
fakeEvent.detail = extraData;
ariaUtilsDelegate.delegate(fakeEvent);
event.cancelBubble = fakeEvent.hasStopPropagation;
event.returnValue = !fakeEvent.hasPreventDefault;
return event.returnValue;
} | javascript | function (event, name, extraData) {
var target = (event.target) ? event.target : event.srcElement;
var fakeEvent = aria.DomEvent.getFakeEvent(name, target);
if (!event.returnValue) {
fakeEvent.preventDefault();
}
if (event.cancelBubble) {
fakeEvent.stopPropagation();
}
fakeEvent.pageX = event.pageX;
fakeEvent.pageY = event.pageY;
fakeEvent.clientX = event.clientX;
fakeEvent.clientY = event.clientY;
fakeEvent.touches = event.touches;
fakeEvent.changedTouches = event.changedTouches;
fakeEvent.isPrimary = event.isPrimary;
if (this.startData) {
if (this.startData.time) {
fakeEvent.duration = (new Date()).getTime() - this.startData.time;
}
}
if (!extraData) {
extraData = {};
}
extraData.startX = this.startData.positions[0].x;
extraData.startY = this.startData.positions[0].y;
var position = ariaTouchEvent.getPositions(event);
extraData.currentX = position[0].x;
extraData.currentY = position[0].y;
fakeEvent.detail = extraData;
ariaUtilsDelegate.delegate(fakeEvent);
event.cancelBubble = fakeEvent.hasStopPropagation;
event.returnValue = !fakeEvent.hasPreventDefault;
return event.returnValue;
} | [
"function",
"(",
"event",
",",
"name",
",",
"extraData",
")",
"{",
"var",
"target",
"=",
"(",
"event",
".",
"target",
")",
"?",
"event",
".",
"target",
":",
"event",
".",
"srcElement",
";",
"var",
"fakeEvent",
"=",
"aria",
".",
"DomEvent",
".",
"getFakeEvent",
"(",
"name",
",",
"target",
")",
";",
"if",
"(",
"!",
"event",
".",
"returnValue",
")",
"{",
"fakeEvent",
".",
"preventDefault",
"(",
")",
";",
"}",
"if",
"(",
"event",
".",
"cancelBubble",
")",
"{",
"fakeEvent",
".",
"stopPropagation",
"(",
")",
";",
"}",
"fakeEvent",
".",
"pageX",
"=",
"event",
".",
"pageX",
";",
"fakeEvent",
".",
"pageY",
"=",
"event",
".",
"pageY",
";",
"fakeEvent",
".",
"clientX",
"=",
"event",
".",
"clientX",
";",
"fakeEvent",
".",
"clientY",
"=",
"event",
".",
"clientY",
";",
"fakeEvent",
".",
"touches",
"=",
"event",
".",
"touches",
";",
"fakeEvent",
".",
"changedTouches",
"=",
"event",
".",
"changedTouches",
";",
"fakeEvent",
".",
"isPrimary",
"=",
"event",
".",
"isPrimary",
";",
"if",
"(",
"this",
".",
"startData",
")",
"{",
"if",
"(",
"this",
".",
"startData",
".",
"time",
")",
"{",
"fakeEvent",
".",
"duration",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
"-",
"this",
".",
"startData",
".",
"time",
";",
"}",
"}",
"if",
"(",
"!",
"extraData",
")",
"{",
"extraData",
"=",
"{",
"}",
";",
"}",
"extraData",
".",
"startX",
"=",
"this",
".",
"startData",
".",
"positions",
"[",
"0",
"]",
".",
"x",
";",
"extraData",
".",
"startY",
"=",
"this",
".",
"startData",
".",
"positions",
"[",
"0",
"]",
".",
"y",
";",
"var",
"position",
"=",
"ariaTouchEvent",
".",
"getPositions",
"(",
"event",
")",
";",
"extraData",
".",
"currentX",
"=",
"position",
"[",
"0",
"]",
".",
"x",
";",
"extraData",
".",
"currentY",
"=",
"position",
"[",
"0",
"]",
".",
"y",
";",
"fakeEvent",
".",
"detail",
"=",
"extraData",
";",
"ariaUtilsDelegate",
".",
"delegate",
"(",
"fakeEvent",
")",
";",
"event",
".",
"cancelBubble",
"=",
"fakeEvent",
".",
"hasStopPropagation",
";",
"event",
".",
"returnValue",
"=",
"!",
"fakeEvent",
".",
"hasPreventDefault",
";",
"return",
"event",
".",
"returnValue",
";",
"}"
]
| Raises a fake event, using Delegate.delegate to accurately delegate the event to the appropriate DOM element.
@param {Object} event the original event
@param {String} name the fake event name
@protected
@return {Boolean} false if preventDefault is true | [
"Raises",
"a",
"fake",
"event",
"using",
"Delegate",
".",
"delegate",
"to",
"accurately",
"delegate",
"the",
"event",
"to",
"the",
"appropriate",
"DOM",
"element",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/Gesture.js#L281-L315 | train |
|
ariatemplates/ariatemplates | src/aria/core/environment/Customizations.js | function (ioRes) {
var downloadFailed = (ioRes.status != '200');
if (downloadFailed) {
this.$logError(this.DESCRIPTOR_NOT_LOADED, this._customizationDescriptor);
} else {
var resJson = ariaUtilsJson.load(ioRes.responseText);
if (resJson == null) {
// the descriptor was not valid json
this.$logError(this.INVALID_DESCRIPTOR, this._customizationDescriptor);
this.$raiseEvent("descriptorLoaded");
return;
}
this._setCustomizationDescriptor(resJson);
}
this._descriptorLoaded = true;
this.$raiseEvent("descriptorLoaded");
} | javascript | function (ioRes) {
var downloadFailed = (ioRes.status != '200');
if (downloadFailed) {
this.$logError(this.DESCRIPTOR_NOT_LOADED, this._customizationDescriptor);
} else {
var resJson = ariaUtilsJson.load(ioRes.responseText);
if (resJson == null) {
// the descriptor was not valid json
this.$logError(this.INVALID_DESCRIPTOR, this._customizationDescriptor);
this.$raiseEvent("descriptorLoaded");
return;
}
this._setCustomizationDescriptor(resJson);
}
this._descriptorLoaded = true;
this.$raiseEvent("descriptorLoaded");
} | [
"function",
"(",
"ioRes",
")",
"{",
"var",
"downloadFailed",
"=",
"(",
"ioRes",
".",
"status",
"!=",
"'200'",
")",
";",
"if",
"(",
"downloadFailed",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"DESCRIPTOR_NOT_LOADED",
",",
"this",
".",
"_customizationDescriptor",
")",
";",
"}",
"else",
"{",
"var",
"resJson",
"=",
"ariaUtilsJson",
".",
"load",
"(",
"ioRes",
".",
"responseText",
")",
";",
"if",
"(",
"resJson",
"==",
"null",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_DESCRIPTOR",
",",
"this",
".",
"_customizationDescriptor",
")",
";",
"this",
".",
"$raiseEvent",
"(",
"\"descriptorLoaded\"",
")",
";",
"return",
";",
"}",
"this",
".",
"_setCustomizationDescriptor",
"(",
"resJson",
")",
";",
"}",
"this",
".",
"_descriptorLoaded",
"=",
"true",
";",
"this",
".",
"$raiseEvent",
"(",
"\"descriptorLoaded\"",
")",
";",
"}"
]
| Internal callback called by the IO object when the customization descriptor has been succesfully received
@protected
@param {Object} ioRes IO result object | [
"Internal",
"callback",
"called",
"by",
"the",
"IO",
"object",
"when",
"the",
"customization",
"descriptor",
"has",
"been",
"succesfully",
"received"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/environment/Customizations.js#L99-L117 | train |
|
ariatemplates/ariatemplates | src/aria/core/environment/Customizations.js | function () {
this._isCustomized = (this._customizationDescriptor ? true : false);
if (this._isCustomized) {
this._descriptorLoaded = false;
if (ariaUtilsType.isString(this._customizationDescriptor)) {
ariaCoreIO.asyncRequest({
url : this._customizationDescriptor,
callback : {
fn : this._onDescriptorReceive,
onerror : this._onDescriptorReceive,
scope : this
}
});
} else {
this._setCustomizationDescriptor(this._customizationDescriptor);
this._descriptorLoaded = true;
this.$raiseEvent("descriptorLoaded");
}
}
} | javascript | function () {
this._isCustomized = (this._customizationDescriptor ? true : false);
if (this._isCustomized) {
this._descriptorLoaded = false;
if (ariaUtilsType.isString(this._customizationDescriptor)) {
ariaCoreIO.asyncRequest({
url : this._customizationDescriptor,
callback : {
fn : this._onDescriptorReceive,
onerror : this._onDescriptorReceive,
scope : this
}
});
} else {
this._setCustomizationDescriptor(this._customizationDescriptor);
this._descriptorLoaded = true;
this.$raiseEvent("descriptorLoaded");
}
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"_isCustomized",
"=",
"(",
"this",
".",
"_customizationDescriptor",
"?",
"true",
":",
"false",
")",
";",
"if",
"(",
"this",
".",
"_isCustomized",
")",
"{",
"this",
".",
"_descriptorLoaded",
"=",
"false",
";",
"if",
"(",
"ariaUtilsType",
".",
"isString",
"(",
"this",
".",
"_customizationDescriptor",
")",
")",
"{",
"ariaCoreIO",
".",
"asyncRequest",
"(",
"{",
"url",
":",
"this",
".",
"_customizationDescriptor",
",",
"callback",
":",
"{",
"fn",
":",
"this",
".",
"_onDescriptorReceive",
",",
"onerror",
":",
"this",
".",
"_onDescriptorReceive",
",",
"scope",
":",
"this",
"}",
"}",
")",
";",
"}",
"else",
"{",
"this",
".",
"_setCustomizationDescriptor",
"(",
"this",
".",
"_customizationDescriptor",
")",
";",
"this",
".",
"_descriptorLoaded",
"=",
"true",
";",
"this",
".",
"$raiseEvent",
"(",
"\"descriptorLoaded\"",
")",
";",
"}",
"}",
"}"
]
| Reload the customization descriptor from the URL passed in the environment
@public | [
"Reload",
"the",
"customization",
"descriptor",
"from",
"the",
"URL",
"passed",
"in",
"the",
"environment"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/environment/Customizations.js#L142-L162 | train |
|
ariatemplates/ariatemplates | src/aria/core/environment/Customizations.js | function (originalCP) {
var newCP = originalCP;
if (this._isCustomized) {
if (this._customizations.flows[originalCP] != null) {
newCP = this._customizations.flows[originalCP];
}
}
return newCP;
} | javascript | function (originalCP) {
var newCP = originalCP;
if (this._isCustomized) {
if (this._customizations.flows[originalCP] != null) {
newCP = this._customizations.flows[originalCP];
}
}
return newCP;
} | [
"function",
"(",
"originalCP",
")",
"{",
"var",
"newCP",
"=",
"originalCP",
";",
"if",
"(",
"this",
".",
"_isCustomized",
")",
"{",
"if",
"(",
"this",
".",
"_customizations",
".",
"flows",
"[",
"originalCP",
"]",
"!=",
"null",
")",
"{",
"newCP",
"=",
"this",
".",
"_customizations",
".",
"flows",
"[",
"originalCP",
"]",
";",
"}",
"}",
"return",
"newCP",
";",
"}"
]
| Returns the classpath of the custom flow which is to replace an original template, or the original template's
CP if no customization for the template was specified
@public
@param {String} originalCP The original ClassPath | [
"Returns",
"the",
"classpath",
"of",
"the",
"custom",
"flow",
"which",
"is",
"to",
"replace",
"an",
"original",
"template",
"or",
"the",
"original",
"template",
"s",
"CP",
"if",
"no",
"customization",
"for",
"the",
"template",
"was",
"specified"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/environment/Customizations.js#L188-L196 | train |
|
ariatemplates/ariatemplates | src/aria/core/environment/Customizations.js | function (originalCP) {
var newCP = originalCP;
if (this._isCustomized) {
if (this._customizations.templates[originalCP] != null) {
newCP = this._customizations.templates[originalCP];
}
}
return newCP;
} | javascript | function (originalCP) {
var newCP = originalCP;
if (this._isCustomized) {
if (this._customizations.templates[originalCP] != null) {
newCP = this._customizations.templates[originalCP];
}
}
return newCP;
} | [
"function",
"(",
"originalCP",
")",
"{",
"var",
"newCP",
"=",
"originalCP",
";",
"if",
"(",
"this",
".",
"_isCustomized",
")",
"{",
"if",
"(",
"this",
".",
"_customizations",
".",
"templates",
"[",
"originalCP",
"]",
"!=",
"null",
")",
"{",
"newCP",
"=",
"this",
".",
"_customizations",
".",
"templates",
"[",
"originalCP",
"]",
";",
"}",
"}",
"return",
"newCP",
";",
"}"
]
| Returns the classpath of the custom template which is to replace an original template, or the original
template's CP if no customization for the template was specified
@public
@param {String} originalCP The original ClassPath
@return {String} customized cp | [
"Returns",
"the",
"classpath",
"of",
"the",
"custom",
"template",
"which",
"is",
"to",
"replace",
"an",
"original",
"template",
"or",
"the",
"original",
"template",
"s",
"CP",
"if",
"no",
"customization",
"for",
"the",
"template",
"was",
"specified"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/environment/Customizations.js#L231-L239 | train |
|
LoginRadius/node-js-sdk | loginradius-sdk/helper.js | getSott | function getSott(callback, config, startDate, endDate ) {
var cipher = require('./sdk/sott')(config.apisecret, config.apikey, startDate, endDate);
cipher.then(
function(sott) {
return callback(sott);
},
function(reason) {
console.log(reason);
});
} | javascript | function getSott(callback, config, startDate, endDate ) {
var cipher = require('./sdk/sott')(config.apisecret, config.apikey, startDate, endDate);
cipher.then(
function(sott) {
return callback(sott);
},
function(reason) {
console.log(reason);
});
} | [
"function",
"getSott",
"(",
"callback",
",",
"config",
",",
"startDate",
",",
"endDate",
")",
"{",
"var",
"cipher",
"=",
"require",
"(",
"'./sdk/sott'",
")",
"(",
"config",
".",
"apisecret",
",",
"config",
".",
"apikey",
",",
"startDate",
",",
"endDate",
")",
";",
"cipher",
".",
"then",
"(",
"function",
"(",
"sott",
")",
"{",
"return",
"callback",
"(",
"sott",
")",
";",
"}",
",",
"function",
"(",
"reason",
")",
"{",
"console",
".",
"log",
"(",
"reason",
")",
";",
"}",
")",
";",
"}"
]
| Calculate SOTT. | [
"Calculate",
"SOTT",
"."
]
| f80a2e1d8709f24d307e8e80132da53c46d5525b | https://github.com/LoginRadius/node-js-sdk/blob/f80a2e1d8709f24d307e8e80132da53c46d5525b/loginradius-sdk/helper.js#L37-L46 | train |
ariatemplates/ariatemplates | src/aria/utils/Delegate.js | function () {
this.cleanCache();
var mapping = this.__delegateMapping;
if (mapping) {
for (var id in mapping) {
if (mapping.hasOwnProperty(id)) {
this.remove(id);
}
}
var body = Aria.$window.document.body;
var utilEvent = ariaUtilsEvent, index, l;
for (index = 0, l = this.delegatedOnBody.length; index < l; index++) {
utilEvent.removeListener(body, this.delegatedOnBody[index], {
fn : this.delegate
});
}
for (index = 0, l = this.delegatedOnWindow.length; index < l; index++) {
utilEvent.removeListener(this.rootListener, this.delegatedOnWindow[index], {
fn : this.delegate
});
}
this.__delegateMapping = null;
// do this after removing listeners as we need it to remove listeners:
this.rootListener = null;
// nullify dom reference
this._focusTracking = null;
ariaUtilsAriaWindow.detachWindow();
}
} | javascript | function () {
this.cleanCache();
var mapping = this.__delegateMapping;
if (mapping) {
for (var id in mapping) {
if (mapping.hasOwnProperty(id)) {
this.remove(id);
}
}
var body = Aria.$window.document.body;
var utilEvent = ariaUtilsEvent, index, l;
for (index = 0, l = this.delegatedOnBody.length; index < l; index++) {
utilEvent.removeListener(body, this.delegatedOnBody[index], {
fn : this.delegate
});
}
for (index = 0, l = this.delegatedOnWindow.length; index < l; index++) {
utilEvent.removeListener(this.rootListener, this.delegatedOnWindow[index], {
fn : this.delegate
});
}
this.__delegateMapping = null;
// do this after removing listeners as we need it to remove listeners:
this.rootListener = null;
// nullify dom reference
this._focusTracking = null;
ariaUtilsAriaWindow.detachWindow();
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"cleanCache",
"(",
")",
";",
"var",
"mapping",
"=",
"this",
".",
"__delegateMapping",
";",
"if",
"(",
"mapping",
")",
"{",
"for",
"(",
"var",
"id",
"in",
"mapping",
")",
"{",
"if",
"(",
"mapping",
".",
"hasOwnProperty",
"(",
"id",
")",
")",
"{",
"this",
".",
"remove",
"(",
"id",
")",
";",
"}",
"}",
"var",
"body",
"=",
"Aria",
".",
"$window",
".",
"document",
".",
"body",
";",
"var",
"utilEvent",
"=",
"ariaUtilsEvent",
",",
"index",
",",
"l",
";",
"for",
"(",
"index",
"=",
"0",
",",
"l",
"=",
"this",
".",
"delegatedOnBody",
".",
"length",
";",
"index",
"<",
"l",
";",
"index",
"++",
")",
"{",
"utilEvent",
".",
"removeListener",
"(",
"body",
",",
"this",
".",
"delegatedOnBody",
"[",
"index",
"]",
",",
"{",
"fn",
":",
"this",
".",
"delegate",
"}",
")",
";",
"}",
"for",
"(",
"index",
"=",
"0",
",",
"l",
"=",
"this",
".",
"delegatedOnWindow",
".",
"length",
";",
"index",
"<",
"l",
";",
"index",
"++",
")",
"{",
"utilEvent",
".",
"removeListener",
"(",
"this",
".",
"rootListener",
",",
"this",
".",
"delegatedOnWindow",
"[",
"index",
"]",
",",
"{",
"fn",
":",
"this",
".",
"delegate",
"}",
")",
";",
"}",
"this",
".",
"__delegateMapping",
"=",
"null",
";",
"this",
".",
"rootListener",
"=",
"null",
";",
"this",
".",
"_focusTracking",
"=",
"null",
";",
"ariaUtilsAriaWindow",
".",
"detachWindow",
"(",
")",
";",
"}",
"}"
]
| Remove all event delegation listeners, and make sure we don't store any references to DOM elements. | [
"Remove",
"all",
"event",
"delegation",
"listeners",
"and",
"make",
"sure",
"we",
"don",
"t",
"store",
"any",
"references",
"to",
"DOM",
"elements",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Delegate.js#L272-L306 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Delegate.js | function (handler) {
this.cleanCache();
// initialization of delegation manager
if (!this.__delegateMapping) {
ariaUtilsAriaWindow.attachWindow();
var body = Aria.$window.document.body;
this.rootListener = ariaCoreBrowser.isOldIE ? body : Aria.$window;
this.__delegateMapping = {};
var utilEvent = ariaUtilsEvent, index, l;
for (index = 0, l = this.delegatedOnBody.length; index < l; index++) {
utilEvent.addListener(body, this.delegatedOnBody[index], {
fn : this.delegate,
scope : this
});
}
for (index = 0, l = this.delegatedOnWindow.length; index < l; index++) {
utilEvent.addListener(this.rootListener, this.delegatedOnWindow[index], {
fn : this.delegate,
scope : this
});
}
}
var id = this.__idMgr.getId();
while (this._changed && this._changed[id]) {
this._changed[id] = false;
id = this.__idMgr.getId();
}
this.__delegateMapping[id] = new ariaUtilsCallback(handler);
return id;
} | javascript | function (handler) {
this.cleanCache();
// initialization of delegation manager
if (!this.__delegateMapping) {
ariaUtilsAriaWindow.attachWindow();
var body = Aria.$window.document.body;
this.rootListener = ariaCoreBrowser.isOldIE ? body : Aria.$window;
this.__delegateMapping = {};
var utilEvent = ariaUtilsEvent, index, l;
for (index = 0, l = this.delegatedOnBody.length; index < l; index++) {
utilEvent.addListener(body, this.delegatedOnBody[index], {
fn : this.delegate,
scope : this
});
}
for (index = 0, l = this.delegatedOnWindow.length; index < l; index++) {
utilEvent.addListener(this.rootListener, this.delegatedOnWindow[index], {
fn : this.delegate,
scope : this
});
}
}
var id = this.__idMgr.getId();
while (this._changed && this._changed[id]) {
this._changed[id] = false;
id = this.__idMgr.getId();
}
this.__delegateMapping[id] = new ariaUtilsCallback(handler);
return id;
} | [
"function",
"(",
"handler",
")",
"{",
"this",
".",
"cleanCache",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"__delegateMapping",
")",
"{",
"ariaUtilsAriaWindow",
".",
"attachWindow",
"(",
")",
";",
"var",
"body",
"=",
"Aria",
".",
"$window",
".",
"document",
".",
"body",
";",
"this",
".",
"rootListener",
"=",
"ariaCoreBrowser",
".",
"isOldIE",
"?",
"body",
":",
"Aria",
".",
"$window",
";",
"this",
".",
"__delegateMapping",
"=",
"{",
"}",
";",
"var",
"utilEvent",
"=",
"ariaUtilsEvent",
",",
"index",
",",
"l",
";",
"for",
"(",
"index",
"=",
"0",
",",
"l",
"=",
"this",
".",
"delegatedOnBody",
".",
"length",
";",
"index",
"<",
"l",
";",
"index",
"++",
")",
"{",
"utilEvent",
".",
"addListener",
"(",
"body",
",",
"this",
".",
"delegatedOnBody",
"[",
"index",
"]",
",",
"{",
"fn",
":",
"this",
".",
"delegate",
",",
"scope",
":",
"this",
"}",
")",
";",
"}",
"for",
"(",
"index",
"=",
"0",
",",
"l",
"=",
"this",
".",
"delegatedOnWindow",
".",
"length",
";",
"index",
"<",
"l",
";",
"index",
"++",
")",
"{",
"utilEvent",
".",
"addListener",
"(",
"this",
".",
"rootListener",
",",
"this",
".",
"delegatedOnWindow",
"[",
"index",
"]",
",",
"{",
"fn",
":",
"this",
".",
"delegate",
",",
"scope",
":",
"this",
"}",
")",
";",
"}",
"}",
"var",
"id",
"=",
"this",
".",
"__idMgr",
".",
"getId",
"(",
")",
";",
"while",
"(",
"this",
".",
"_changed",
"&&",
"this",
".",
"_changed",
"[",
"id",
"]",
")",
"{",
"this",
".",
"_changed",
"[",
"id",
"]",
"=",
"false",
";",
"id",
"=",
"this",
".",
"__idMgr",
".",
"getId",
"(",
")",
";",
"}",
"this",
".",
"__delegateMapping",
"[",
"id",
"]",
"=",
"new",
"ariaUtilsCallback",
"(",
"handler",
")",
";",
"return",
"id",
";",
"}"
]
| Plug event listener to be able to listen to delegated events
@param {aria.core.CfgBeans:Callback} handler
@return {String} id for delegation. | [
"Plug",
"event",
"listener",
"to",
"be",
"able",
"to",
"listen",
"to",
"delegated",
"events"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Delegate.js#L322-L353 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Delegate.js | function (domElt, id) {
domElt.setAttribute(this.delegateExpando, id);
// for iOS, refer to method getMarkup
if (ariaCoreBrowser.isIOS) {
if (domElt.onclick == null) {
domElt.onclick = Aria.empty;
}
}
} | javascript | function (domElt, id) {
domElt.setAttribute(this.delegateExpando, id);
// for iOS, refer to method getMarkup
if (ariaCoreBrowser.isIOS) {
if (domElt.onclick == null) {
domElt.onclick = Aria.empty;
}
}
} | [
"function",
"(",
"domElt",
",",
"id",
")",
"{",
"domElt",
".",
"setAttribute",
"(",
"this",
".",
"delegateExpando",
",",
"id",
")",
";",
"if",
"(",
"ariaCoreBrowser",
".",
"isIOS",
")",
"{",
"if",
"(",
"domElt",
".",
"onclick",
"==",
"null",
")",
"{",
"domElt",
".",
"onclick",
"=",
"Aria",
".",
"empty",
";",
"}",
"}",
"}"
]
| Add the delegate expando on an existing dom element
@param {HTMLElement} domElt
@param {string} id | [
"Add",
"the",
"delegate",
"expando",
"on",
"an",
"existing",
"dom",
"element"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Delegate.js#L375-L384 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Delegate.js | function (eventName, delegateId, wrapTarget) {
if (ariaCoreBrowser.isOldIE) {
this.getFallbackMarkup = function (eventName, delegateId, wrapTarget) {
wrapTarget = wrapTarget ? "true" : "false";
return " on" + eventName + "=\"aria.utils.Delegate.directCall(event, '" + delegateId + "', "
+ wrapTarget + ", this)\"";
};
} else {
this.getFallbackMarkup = function (eventName, delegateId, wrapTarget) {
var calledFunction = "directCall";
wrapTarget = wrapTarget ? "true" : "false";
if ('mouseleave' == eventName || 'mouseenter' == eventName) {
// Mouseleave/enter exists only in IE, we can emulate them in all other browsers
eventName = 'mouseleave' == eventName ? 'mouseout' : 'mouseover';
calledFunction = "mouseMovement";
}
return " on" + eventName + "=\"aria.utils.Delegate." + calledFunction + "(event, '" + delegateId
+ "', " + wrapTarget + ", this)\"";
};
}
return this.getFallbackMarkup(eventName, delegateId, wrapTarget);
} | javascript | function (eventName, delegateId, wrapTarget) {
if (ariaCoreBrowser.isOldIE) {
this.getFallbackMarkup = function (eventName, delegateId, wrapTarget) {
wrapTarget = wrapTarget ? "true" : "false";
return " on" + eventName + "=\"aria.utils.Delegate.directCall(event, '" + delegateId + "', "
+ wrapTarget + ", this)\"";
};
} else {
this.getFallbackMarkup = function (eventName, delegateId, wrapTarget) {
var calledFunction = "directCall";
wrapTarget = wrapTarget ? "true" : "false";
if ('mouseleave' == eventName || 'mouseenter' == eventName) {
// Mouseleave/enter exists only in IE, we can emulate them in all other browsers
eventName = 'mouseleave' == eventName ? 'mouseout' : 'mouseover';
calledFunction = "mouseMovement";
}
return " on" + eventName + "=\"aria.utils.Delegate." + calledFunction + "(event, '" + delegateId
+ "', " + wrapTarget + ", this)\"";
};
}
return this.getFallbackMarkup(eventName, delegateId, wrapTarget);
} | [
"function",
"(",
"eventName",
",",
"delegateId",
",",
"wrapTarget",
")",
"{",
"if",
"(",
"ariaCoreBrowser",
".",
"isOldIE",
")",
"{",
"this",
".",
"getFallbackMarkup",
"=",
"function",
"(",
"eventName",
",",
"delegateId",
",",
"wrapTarget",
")",
"{",
"wrapTarget",
"=",
"wrapTarget",
"?",
"\"true\"",
":",
"\"false\"",
";",
"return",
"\" on\"",
"+",
"eventName",
"+",
"\"=\\\"aria.utils.Delegate.directCall(event, '\"",
"+",
"\\\"",
"+",
"delegateId",
"+",
"\"', \"",
"+",
"wrapTarget",
";",
"}",
";",
"}",
"else",
"\", this)\\\"\"",
"\\\"",
"}"
]
| Generate classic "onsomething" markup for event not supported by delegation
@param {String} eventName
@param {String} callback id
@param {Boolean} wrapTarget, if true, wrap target into DOMWrapper
@method
@return {String} | [
"Generate",
"classic",
"onsomething",
"markup",
"for",
"event",
"not",
"supported",
"by",
"delegation"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Delegate.js#L394-L417 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Delegate.js | function (event, templatesWrapper) {
if (event.$DomEvent) {
// It's already wrapped
return event;
} else {
return templatesWrapper ? new aria.templates.DomEventWrapper(event) : new ariaDomEvent(event);
}
} | javascript | function (event, templatesWrapper) {
if (event.$DomEvent) {
// It's already wrapped
return event;
} else {
return templatesWrapper ? new aria.templates.DomEventWrapper(event) : new ariaDomEvent(event);
}
} | [
"function",
"(",
"event",
",",
"templatesWrapper",
")",
"{",
"if",
"(",
"event",
".",
"$DomEvent",
")",
"{",
"return",
"event",
";",
"}",
"else",
"{",
"return",
"templatesWrapper",
"?",
"new",
"aria",
".",
"templates",
".",
"DomEventWrapper",
"(",
"event",
")",
":",
"new",
"ariaDomEvent",
"(",
"event",
")",
";",
"}",
"}"
]
| Wrap a standard HTMLElement inside a DomEvent or DomEventWrapper
@param {HTMLEvent} event Event to wrap
@param {Boolean} templatesWrapper True to wrap an aria.templates.DomEventWrapper, False for aria.DomEvent
@return {aria.DomEvent} | [
"Wrap",
"a",
"standard",
"HTMLElement",
"inside",
"a",
"DomEvent",
"or",
"DomEventWrapper"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Delegate.js#L425-L432 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Delegate.js | function (event, delegateId, wrapTarget, container) {
this.$assert(286, this.__delegateMapping);
var eventWrapper = this.__wrapEvent(event, wrapTarget), result;
var callback = this.__delegateMapping[delegateId];
if (callback) {
result = callback.call(eventWrapper);
}
eventWrapper.$dispose();
return result;
} | javascript | function (event, delegateId, wrapTarget, container) {
this.$assert(286, this.__delegateMapping);
var eventWrapper = this.__wrapEvent(event, wrapTarget), result;
var callback = this.__delegateMapping[delegateId];
if (callback) {
result = callback.call(eventWrapper);
}
eventWrapper.$dispose();
return result;
} | [
"function",
"(",
"event",
",",
"delegateId",
",",
"wrapTarget",
",",
"container",
")",
"{",
"this",
".",
"$assert",
"(",
"286",
",",
"this",
".",
"__delegateMapping",
")",
";",
"var",
"eventWrapper",
"=",
"this",
".",
"__wrapEvent",
"(",
"event",
",",
"wrapTarget",
")",
",",
"result",
";",
"var",
"callback",
"=",
"this",
".",
"__delegateMapping",
"[",
"delegateId",
"]",
";",
"if",
"(",
"callback",
")",
"{",
"result",
"=",
"callback",
".",
"call",
"(",
"eventWrapper",
")",
";",
"}",
"eventWrapper",
".",
"$dispose",
"(",
")",
";",
"return",
"result",
";",
"}"
]
| Entry point for event that were not delegated
@param {HTMLEvent} event HTML Event
@param {String} delegateId Id of the delegated callback
@param {Boolean} wrapTarget, if true, wrap target into DomEventWrapper
@param {HTMLElement} container HTML Element on which the listener is attached
@return {Object} Return value of the callback | [
"Entry",
"point",
"for",
"event",
"that",
"were",
"not",
"delegated"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Delegate.js#L442-L451 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Delegate.js | function (id) {
this.cleanCache();
// store id to identify changes during callback execution
if (this._changed) {
this._changed[id] = true;
}
if (this.__delegateMapping) {
this.__delegateMapping[id].$dispose();
delete this.__delegateMapping[id];
this.__idMgr.releaseId(id);
}
} | javascript | function (id) {
this.cleanCache();
// store id to identify changes during callback execution
if (this._changed) {
this._changed[id] = true;
}
if (this.__delegateMapping) {
this.__delegateMapping[id].$dispose();
delete this.__delegateMapping[id];
this.__idMgr.releaseId(id);
}
} | [
"function",
"(",
"id",
")",
"{",
"this",
".",
"cleanCache",
"(",
")",
";",
"if",
"(",
"this",
".",
"_changed",
")",
"{",
"this",
".",
"_changed",
"[",
"id",
"]",
"=",
"true",
";",
"}",
"if",
"(",
"this",
".",
"__delegateMapping",
")",
"{",
"this",
".",
"__delegateMapping",
"[",
"id",
"]",
".",
"$dispose",
"(",
")",
";",
"delete",
"this",
".",
"__delegateMapping",
"[",
"id",
"]",
";",
"this",
".",
"__idMgr",
".",
"releaseId",
"(",
"id",
")",
";",
"}",
"}"
]
| Remove delegation for a given id.
@param {String} id Mapping ID | [
"Remove",
"delegation",
"for",
"a",
"given",
"id",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Delegate.js#L475-L488 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Delegate.js | function () {
if (this.__stackCache) {
for (var key in this.__stackCache) {
if (this.__stackCache.hasOwnProperty(key)) {
var stack = this.__stackCache[key];
// break dom reference
for (var i = 0, l = stack.length; i < l; i++) {
stack.target = null;
stack.expandoValue = null;
delete stack.target;
delete stack.expandoValue;
}
delete this.__stackCache[i];
}
}
this.__stackCache = null;
}
} | javascript | function () {
if (this.__stackCache) {
for (var key in this.__stackCache) {
if (this.__stackCache.hasOwnProperty(key)) {
var stack = this.__stackCache[key];
// break dom reference
for (var i = 0, l = stack.length; i < l; i++) {
stack.target = null;
stack.expandoValue = null;
delete stack.target;
delete stack.expandoValue;
}
delete this.__stackCache[i];
}
}
this.__stackCache = null;
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"__stackCache",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"this",
".",
"__stackCache",
")",
"{",
"if",
"(",
"this",
".",
"__stackCache",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"var",
"stack",
"=",
"this",
".",
"__stackCache",
"[",
"key",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"stack",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"stack",
".",
"target",
"=",
"null",
";",
"stack",
".",
"expandoValue",
"=",
"null",
";",
"delete",
"stack",
".",
"target",
";",
"delete",
"stack",
".",
"expandoValue",
";",
"}",
"delete",
"this",
".",
"__stackCache",
"[",
"i",
"]",
";",
"}",
"}",
"this",
".",
"__stackCache",
"=",
"null",
";",
"}",
"}"
]
| Clean delegate hierachy cache | [
"Clean",
"delegate",
"hierachy",
"cache"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Delegate.js#L635-L652 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (label) {
var report = new aria.widgets.controllers.reports.DropDownControllerReport();
var newSuggestions = ariaUtilsJson.copy(this.selectedSuggestions, false);
var indexToRemove = this._findSuggestion(newSuggestions, {
label : label
});
if (indexToRemove == -1) {
// try to find a free-text option
indexToRemove = ariaUtilsArray.indexOf(newSuggestions, label);
}
if (indexToRemove > -1) {
report.removedSuggestion = newSuggestions[indexToRemove];
ariaUtilsArray.removeAt(newSuggestions, indexToRemove);
this.selectedSuggestions = newSuggestions;
}
report.removedSuggestionIndex = indexToRemove;
report.value = this.selectedSuggestions;
return report;
} | javascript | function (label) {
var report = new aria.widgets.controllers.reports.DropDownControllerReport();
var newSuggestions = ariaUtilsJson.copy(this.selectedSuggestions, false);
var indexToRemove = this._findSuggestion(newSuggestions, {
label : label
});
if (indexToRemove == -1) {
// try to find a free-text option
indexToRemove = ariaUtilsArray.indexOf(newSuggestions, label);
}
if (indexToRemove > -1) {
report.removedSuggestion = newSuggestions[indexToRemove];
ariaUtilsArray.removeAt(newSuggestions, indexToRemove);
this.selectedSuggestions = newSuggestions;
}
report.removedSuggestionIndex = indexToRemove;
report.value = this.selectedSuggestions;
return report;
} | [
"function",
"(",
"label",
")",
"{",
"var",
"report",
"=",
"new",
"aria",
".",
"widgets",
".",
"controllers",
".",
"reports",
".",
"DropDownControllerReport",
"(",
")",
";",
"var",
"newSuggestions",
"=",
"ariaUtilsJson",
".",
"copy",
"(",
"this",
".",
"selectedSuggestions",
",",
"false",
")",
";",
"var",
"indexToRemove",
"=",
"this",
".",
"_findSuggestion",
"(",
"newSuggestions",
",",
"{",
"label",
":",
"label",
"}",
")",
";",
"if",
"(",
"indexToRemove",
"==",
"-",
"1",
")",
"{",
"indexToRemove",
"=",
"ariaUtilsArray",
".",
"indexOf",
"(",
"newSuggestions",
",",
"label",
")",
";",
"}",
"if",
"(",
"indexToRemove",
">",
"-",
"1",
")",
"{",
"report",
".",
"removedSuggestion",
"=",
"newSuggestions",
"[",
"indexToRemove",
"]",
";",
"ariaUtilsArray",
".",
"removeAt",
"(",
"newSuggestions",
",",
"indexToRemove",
")",
";",
"this",
".",
"selectedSuggestions",
"=",
"newSuggestions",
";",
"}",
"report",
".",
"removedSuggestionIndex",
"=",
"indexToRemove",
";",
"report",
".",
"value",
"=",
"this",
".",
"selectedSuggestions",
";",
"return",
"report",
";",
"}"
]
| Removal of a suggestion
@param {String} label
@return {aria.widgets.controllers.reports.DropDownControllerReport}
@override | [
"Removal",
"of",
"a",
"suggestion"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L132-L152 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (value, removedSuggestionIndex) {
var dataModel = this._dataModel;
this._editedSuggestionIndex = removedSuggestionIndex;
var report = new aria.widgets.controllers.reports.DropDownControllerReport();
dataModel.value = value;
dataModel.text = typeUtil.isString(value) ? value : value.label;
report.text = dataModel.text;
report.caretPosStart = 0;
report.caretPosEnd = report.text.length;
report.value = this.selectedSuggestions;
return report;
} | javascript | function (value, removedSuggestionIndex) {
var dataModel = this._dataModel;
this._editedSuggestionIndex = removedSuggestionIndex;
var report = new aria.widgets.controllers.reports.DropDownControllerReport();
dataModel.value = value;
dataModel.text = typeUtil.isString(value) ? value : value.label;
report.text = dataModel.text;
report.caretPosStart = 0;
report.caretPosEnd = report.text.length;
report.value = this.selectedSuggestions;
return report;
} | [
"function",
"(",
"value",
",",
"removedSuggestionIndex",
")",
"{",
"var",
"dataModel",
"=",
"this",
".",
"_dataModel",
";",
"this",
".",
"_editedSuggestionIndex",
"=",
"removedSuggestionIndex",
";",
"var",
"report",
"=",
"new",
"aria",
".",
"widgets",
".",
"controllers",
".",
"reports",
".",
"DropDownControllerReport",
"(",
")",
";",
"dataModel",
".",
"value",
"=",
"value",
";",
"dataModel",
".",
"text",
"=",
"typeUtil",
".",
"isString",
"(",
"value",
")",
"?",
"value",
":",
"value",
".",
"label",
";",
"report",
".",
"text",
"=",
"dataModel",
".",
"text",
";",
"report",
".",
"caretPosStart",
"=",
"0",
";",
"report",
".",
"caretPosEnd",
"=",
"report",
".",
"text",
".",
"length",
";",
"report",
".",
"value",
"=",
"this",
".",
"selectedSuggestions",
";",
"return",
"report",
";",
"}"
]
| Start editing a value. The value is supposed to have already been removed from the selectedSuggestions
array.
@param {String|Object} value (normally coming from the selectedSuggestions array)
@return {aria.widgets.controllers.reports.DropDownControllerReport} | [
"Start",
"editing",
"a",
"value",
".",
"The",
"value",
"is",
"supposed",
"to",
"have",
"already",
"been",
"removed",
"from",
"the",
"selectedSuggestions",
"array",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L160-L171 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (selectedValues) {
var selectedValuesCopy = ariaUtilsJson.copy(selectedValues, false);
var selectedSuggestionsCopy = ariaUtilsJson.copy(this.selectedSuggestions, false);
for (var i = 0, l = selectedSuggestionsCopy.length; i < l; i++) {
var curSelectedSuggestion = selectedSuggestionsCopy[i];
if (typeUtil.isObject(curSelectedSuggestion)) {
var index = this._findSuggestion(selectedValuesCopy, curSelectedSuggestion);
if (index > -1) {
arrayUtil.removeAt(selectedValuesCopy, index);
} else {
arrayUtil.removeAt(selectedSuggestionsCopy, i);
l--;
i--;
}
}
}
selectedSuggestionsCopy = selectedSuggestionsCopy.concat(selectedValuesCopy);
var report = this.checkValue(selectedSuggestionsCopy);
this._isExpanded = true;
report.repositionDropDown = true;
return report;
} | javascript | function (selectedValues) {
var selectedValuesCopy = ariaUtilsJson.copy(selectedValues, false);
var selectedSuggestionsCopy = ariaUtilsJson.copy(this.selectedSuggestions, false);
for (var i = 0, l = selectedSuggestionsCopy.length; i < l; i++) {
var curSelectedSuggestion = selectedSuggestionsCopy[i];
if (typeUtil.isObject(curSelectedSuggestion)) {
var index = this._findSuggestion(selectedValuesCopy, curSelectedSuggestion);
if (index > -1) {
arrayUtil.removeAt(selectedValuesCopy, index);
} else {
arrayUtil.removeAt(selectedSuggestionsCopy, i);
l--;
i--;
}
}
}
selectedSuggestionsCopy = selectedSuggestionsCopy.concat(selectedValuesCopy);
var report = this.checkValue(selectedSuggestionsCopy);
this._isExpanded = true;
report.repositionDropDown = true;
return report;
} | [
"function",
"(",
"selectedValues",
")",
"{",
"var",
"selectedValuesCopy",
"=",
"ariaUtilsJson",
".",
"copy",
"(",
"selectedValues",
",",
"false",
")",
";",
"var",
"selectedSuggestionsCopy",
"=",
"ariaUtilsJson",
".",
"copy",
"(",
"this",
".",
"selectedSuggestions",
",",
"false",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"selectedSuggestionsCopy",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"var",
"curSelectedSuggestion",
"=",
"selectedSuggestionsCopy",
"[",
"i",
"]",
";",
"if",
"(",
"typeUtil",
".",
"isObject",
"(",
"curSelectedSuggestion",
")",
")",
"{",
"var",
"index",
"=",
"this",
".",
"_findSuggestion",
"(",
"selectedValuesCopy",
",",
"curSelectedSuggestion",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"arrayUtil",
".",
"removeAt",
"(",
"selectedValuesCopy",
",",
"index",
")",
";",
"}",
"else",
"{",
"arrayUtil",
".",
"removeAt",
"(",
"selectedSuggestionsCopy",
",",
"i",
")",
";",
"l",
"--",
";",
"i",
"--",
";",
"}",
"}",
"}",
"selectedSuggestionsCopy",
"=",
"selectedSuggestionsCopy",
".",
"concat",
"(",
"selectedValuesCopy",
")",
";",
"var",
"report",
"=",
"this",
".",
"checkValue",
"(",
"selectedSuggestionsCopy",
")",
";",
"this",
".",
"_isExpanded",
"=",
"true",
";",
"report",
".",
"repositionDropDown",
"=",
"true",
";",
"return",
"report",
";",
"}"
]
| Updates selected values.
@param {Array} values | [
"Updates",
"selected",
"values",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L177-L198 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (value) {
var report = new aria.widgets.controllers.reports.DropDownControllerReport(), dataModel = this._dataModel;
if (value == null) {
dataModel.text = (this._pendingRequestNb > 0 && dataModel.text) ? dataModel.text : "";
dataModel.value = null;
report.ok = true;
this.selectedSuggestions = [];
} else if (typeUtil.isArray(value)) {
if (this._checkWithSuggestionBean(value, this._resourcesHandler.SUGGESTION_BEAN)) {
dataModel.text = "";
dataModel.value = null;
report.ok = true;
this.selectedSuggestions = value;
} else {
report.ok = false;
this.$logError("Value does not match definition for this multiautocomplete: "
+ this._resourcesHandler.SUGGESTION_BEAN, [], value);
}
} else {
report.ok = false;
this.$logError("Wrong multiautocomplete value: " + value, [], value);
}
report.clearSuggestions = true;
report.suggestionsToAdd = report.value = this.selectedSuggestions;
report.text = dataModel.text;
return report;
} | javascript | function (value) {
var report = new aria.widgets.controllers.reports.DropDownControllerReport(), dataModel = this._dataModel;
if (value == null) {
dataModel.text = (this._pendingRequestNb > 0 && dataModel.text) ? dataModel.text : "";
dataModel.value = null;
report.ok = true;
this.selectedSuggestions = [];
} else if (typeUtil.isArray(value)) {
if (this._checkWithSuggestionBean(value, this._resourcesHandler.SUGGESTION_BEAN)) {
dataModel.text = "";
dataModel.value = null;
report.ok = true;
this.selectedSuggestions = value;
} else {
report.ok = false;
this.$logError("Value does not match definition for this multiautocomplete: "
+ this._resourcesHandler.SUGGESTION_BEAN, [], value);
}
} else {
report.ok = false;
this.$logError("Wrong multiautocomplete value: " + value, [], value);
}
report.clearSuggestions = true;
report.suggestionsToAdd = report.value = this.selectedSuggestions;
report.text = dataModel.text;
return report;
} | [
"function",
"(",
"value",
")",
"{",
"var",
"report",
"=",
"new",
"aria",
".",
"widgets",
".",
"controllers",
".",
"reports",
".",
"DropDownControllerReport",
"(",
")",
",",
"dataModel",
"=",
"this",
".",
"_dataModel",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"dataModel",
".",
"text",
"=",
"(",
"this",
".",
"_pendingRequestNb",
">",
"0",
"&&",
"dataModel",
".",
"text",
")",
"?",
"dataModel",
".",
"text",
":",
"\"\"",
";",
"dataModel",
".",
"value",
"=",
"null",
";",
"report",
".",
"ok",
"=",
"true",
";",
"this",
".",
"selectedSuggestions",
"=",
"[",
"]",
";",
"}",
"else",
"if",
"(",
"typeUtil",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"if",
"(",
"this",
".",
"_checkWithSuggestionBean",
"(",
"value",
",",
"this",
".",
"_resourcesHandler",
".",
"SUGGESTION_BEAN",
")",
")",
"{",
"dataModel",
".",
"text",
"=",
"\"\"",
";",
"dataModel",
".",
"value",
"=",
"null",
";",
"report",
".",
"ok",
"=",
"true",
";",
"this",
".",
"selectedSuggestions",
"=",
"value",
";",
"}",
"else",
"{",
"report",
".",
"ok",
"=",
"false",
";",
"this",
".",
"$logError",
"(",
"\"Value does not match definition for this multiautocomplete: \"",
"+",
"this",
".",
"_resourcesHandler",
".",
"SUGGESTION_BEAN",
",",
"[",
"]",
",",
"value",
")",
";",
"}",
"}",
"else",
"{",
"report",
".",
"ok",
"=",
"false",
";",
"this",
".",
"$logError",
"(",
"\"Wrong multiautocomplete value: \"",
"+",
"value",
",",
"[",
"]",
",",
"value",
")",
";",
"}",
"report",
".",
"clearSuggestions",
"=",
"true",
";",
"report",
".",
"suggestionsToAdd",
"=",
"report",
".",
"value",
"=",
"this",
".",
"selectedSuggestions",
";",
"report",
".",
"text",
"=",
"dataModel",
".",
"text",
";",
"return",
"report",
";",
"}"
]
| Checks a value coming from the data model. The MultiAutoComplete only accepts arrays or null values from
the data model.
@param {Array} value
@return {aria.widgets.controllers.reports.DropDownControllerReport}
@override | [
"Checks",
"a",
"value",
"coming",
"from",
"the",
"data",
"model",
".",
"The",
"MultiAutoComplete",
"only",
"accepts",
"arrays",
"or",
"null",
"values",
"from",
"the",
"data",
"model",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L207-L235 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (value) {
if (typeUtil.isString(value) || value == null) {
return new aria.widgets.controllers.reports.DropDownControllerReport();
} else {
var report = new aria.widgets.controllers.reports.DropDownControllerReport();
var dataModel = this._dataModel;
var suggestionsToAdd = typeUtil.isArray(value) ? value : [value];
report.suggestionsToAdd = this._checkNewSuggestions(suggestionsToAdd);
report.value = this.selectedSuggestions;
report.text = "";
dataModel.text = "";
dataModel.value = null;
return report;
}
} | javascript | function (value) {
if (typeUtil.isString(value) || value == null) {
return new aria.widgets.controllers.reports.DropDownControllerReport();
} else {
var report = new aria.widgets.controllers.reports.DropDownControllerReport();
var dataModel = this._dataModel;
var suggestionsToAdd = typeUtil.isArray(value) ? value : [value];
report.suggestionsToAdd = this._checkNewSuggestions(suggestionsToAdd);
report.value = this.selectedSuggestions;
report.text = "";
dataModel.text = "";
dataModel.value = null;
return report;
}
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"typeUtil",
".",
"isString",
"(",
"value",
")",
"||",
"value",
"==",
"null",
")",
"{",
"return",
"new",
"aria",
".",
"widgets",
".",
"controllers",
".",
"reports",
".",
"DropDownControllerReport",
"(",
")",
";",
"}",
"else",
"{",
"var",
"report",
"=",
"new",
"aria",
".",
"widgets",
".",
"controllers",
".",
"reports",
".",
"DropDownControllerReport",
"(",
")",
";",
"var",
"dataModel",
"=",
"this",
".",
"_dataModel",
";",
"var",
"suggestionsToAdd",
"=",
"typeUtil",
".",
"isArray",
"(",
"value",
")",
"?",
"value",
":",
"[",
"value",
"]",
";",
"report",
".",
"suggestionsToAdd",
"=",
"this",
".",
"_checkNewSuggestions",
"(",
"suggestionsToAdd",
")",
";",
"report",
".",
"value",
"=",
"this",
".",
"selectedSuggestions",
";",
"report",
".",
"text",
"=",
"\"\"",
";",
"dataModel",
".",
"text",
"=",
"\"\"",
";",
"dataModel",
".",
"value",
"=",
"null",
";",
"return",
"report",
";",
"}",
"}"
]
| Check the value selected by the user in the dropdown. It is called by checkKeyStroke.
@param {Object} value
@return {aria.widgets.controllers.reports.ControllerReport} | [
"Check",
"the",
"value",
"selected",
"by",
"the",
"user",
"in",
"the",
"dropdown",
".",
"It",
"is",
"called",
"by",
"checkKeyStroke",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L242-L256 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (suggestionToBeAdded) {
var allSuggestions = ariaUtilsJson.copy(this.selectedSuggestions, false);
var res = [];
var maxOptions = this.maxOptions;
var length = suggestionToBeAdded.length;
if (maxOptions && allSuggestions.length + length > maxOptions) {
length = maxOptions - allSuggestions.length;
}
if (length > 0) {
for (var k = 0; k < length; k++) {
if (this._editedSuggestionIndex != -1) {
allSuggestions.splice(this._editedSuggestionIndex, 0, suggestionToBeAdded[k]);
this._editedSuggestionIndex += 1;
} else {
allSuggestions.push(suggestionToBeAdded[k]);
}
res[k] = suggestionToBeAdded[k];
}
this._editedSuggestionIndex = -1;
this.selectedSuggestions = allSuggestions;
}
return res;
} | javascript | function (suggestionToBeAdded) {
var allSuggestions = ariaUtilsJson.copy(this.selectedSuggestions, false);
var res = [];
var maxOptions = this.maxOptions;
var length = suggestionToBeAdded.length;
if (maxOptions && allSuggestions.length + length > maxOptions) {
length = maxOptions - allSuggestions.length;
}
if (length > 0) {
for (var k = 0; k < length; k++) {
if (this._editedSuggestionIndex != -1) {
allSuggestions.splice(this._editedSuggestionIndex, 0, suggestionToBeAdded[k]);
this._editedSuggestionIndex += 1;
} else {
allSuggestions.push(suggestionToBeAdded[k]);
}
res[k] = suggestionToBeAdded[k];
}
this._editedSuggestionIndex = -1;
this.selectedSuggestions = allSuggestions;
}
return res;
} | [
"function",
"(",
"suggestionToBeAdded",
")",
"{",
"var",
"allSuggestions",
"=",
"ariaUtilsJson",
".",
"copy",
"(",
"this",
".",
"selectedSuggestions",
",",
"false",
")",
";",
"var",
"res",
"=",
"[",
"]",
";",
"var",
"maxOptions",
"=",
"this",
".",
"maxOptions",
";",
"var",
"length",
"=",
"suggestionToBeAdded",
".",
"length",
";",
"if",
"(",
"maxOptions",
"&&",
"allSuggestions",
".",
"length",
"+",
"length",
">",
"maxOptions",
")",
"{",
"length",
"=",
"maxOptions",
"-",
"allSuggestions",
".",
"length",
";",
"}",
"if",
"(",
"length",
">",
"0",
")",
"{",
"for",
"(",
"var",
"k",
"=",
"0",
";",
"k",
"<",
"length",
";",
"k",
"++",
")",
"{",
"if",
"(",
"this",
".",
"_editedSuggestionIndex",
"!=",
"-",
"1",
")",
"{",
"allSuggestions",
".",
"splice",
"(",
"this",
".",
"_editedSuggestionIndex",
",",
"0",
",",
"suggestionToBeAdded",
"[",
"k",
"]",
")",
";",
"this",
".",
"_editedSuggestionIndex",
"+=",
"1",
";",
"}",
"else",
"{",
"allSuggestions",
".",
"push",
"(",
"suggestionToBeAdded",
"[",
"k",
"]",
")",
";",
"}",
"res",
"[",
"k",
"]",
"=",
"suggestionToBeAdded",
"[",
"k",
"]",
";",
"}",
"this",
".",
"_editedSuggestionIndex",
"=",
"-",
"1",
";",
"this",
".",
"selectedSuggestions",
"=",
"allSuggestions",
";",
"}",
"return",
"res",
";",
"}"
]
| Pushes new suggestions to the array of selectedSuggestions and return the array of new suggestions.
@protected
@param {Object} suggestionToBeAdded
@return {Array} | [
"Pushes",
"new",
"suggestions",
"to",
"the",
"array",
"of",
"selectedSuggestions",
"and",
"return",
"the",
"array",
"of",
"new",
"suggestions",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L264-L286 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (suggestions) {
var selectedSuggestions = this.selectedSuggestions;
var filteredSuggestions = [];
for (var i = 0; i < suggestions.length; i++) {
var curSuggestion = suggestions[i];
if (this._findSuggestion(selectedSuggestions, curSuggestion) == -1) {
filteredSuggestions.push(curSuggestion);
}
}
return filteredSuggestions;
} | javascript | function (suggestions) {
var selectedSuggestions = this.selectedSuggestions;
var filteredSuggestions = [];
for (var i = 0; i < suggestions.length; i++) {
var curSuggestion = suggestions[i];
if (this._findSuggestion(selectedSuggestions, curSuggestion) == -1) {
filteredSuggestions.push(curSuggestion);
}
}
return filteredSuggestions;
} | [
"function",
"(",
"suggestions",
")",
"{",
"var",
"selectedSuggestions",
"=",
"this",
".",
"selectedSuggestions",
";",
"var",
"filteredSuggestions",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"suggestions",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"curSuggestion",
"=",
"suggestions",
"[",
"i",
"]",
";",
"if",
"(",
"this",
".",
"_findSuggestion",
"(",
"selectedSuggestions",
",",
"curSuggestion",
")",
"==",
"-",
"1",
")",
"{",
"filteredSuggestions",
".",
"push",
"(",
"curSuggestion",
")",
";",
"}",
"}",
"return",
"filteredSuggestions",
";",
"}"
]
| Internal method to filter the suggestion with the added suggestions
@param {Array} suggestions
@return {Array} | [
"Internal",
"method",
"to",
"filter",
"the",
"suggestion",
"with",
"the",
"added",
"suggestions"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L419-L429 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (suggestionsList, suggestion) {
for (var i = 0, l = suggestionsList.length; i < l; i++) {
if (suggestion.label == suggestionsList[i].label) {
return i;
}
}
return -1;
} | javascript | function (suggestionsList, suggestion) {
for (var i = 0, l = suggestionsList.length; i < l; i++) {
if (suggestion.label == suggestionsList[i].label) {
return i;
}
}
return -1;
} | [
"function",
"(",
"suggestionsList",
",",
"suggestion",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"suggestionsList",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"suggestion",
".",
"label",
"==",
"suggestionsList",
"[",
"i",
"]",
".",
"label",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
]
| Returns the index of the given suggestion in the given array of suggestions. The comparison is based on
labels.
@param {Array} suggestionsList
@param {Object} suggestion
@return {Boolean} | [
"Returns",
"the",
"index",
"of",
"the",
"given",
"suggestion",
"in",
"the",
"given",
"array",
"of",
"suggestions",
".",
"The",
"comparison",
"is",
"based",
"on",
"labels",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L438-L445 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiAutoCompleteController.js | function (arrayOfSuggestions, beanName) {
for (var k = 0, l = arrayOfSuggestions.length; k < l; k++) {
var currentSuggestion = arrayOfSuggestions[k];
if (!typeUtil.isString(currentSuggestion)
&& !ariaCoreJsonValidator.check(currentSuggestion, beanName)) {
return false;
}
}
return true;
} | javascript | function (arrayOfSuggestions, beanName) {
for (var k = 0, l = arrayOfSuggestions.length; k < l; k++) {
var currentSuggestion = arrayOfSuggestions[k];
if (!typeUtil.isString(currentSuggestion)
&& !ariaCoreJsonValidator.check(currentSuggestion, beanName)) {
return false;
}
}
return true;
} | [
"function",
"(",
"arrayOfSuggestions",
",",
"beanName",
")",
"{",
"for",
"(",
"var",
"k",
"=",
"0",
",",
"l",
"=",
"arrayOfSuggestions",
".",
"length",
";",
"k",
"<",
"l",
";",
"k",
"++",
")",
"{",
"var",
"currentSuggestion",
"=",
"arrayOfSuggestions",
"[",
"k",
"]",
";",
"if",
"(",
"!",
"typeUtil",
".",
"isString",
"(",
"currentSuggestion",
")",
"&&",
"!",
"ariaCoreJsonValidator",
".",
"check",
"(",
"currentSuggestion",
",",
"beanName",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
]
| Internal method to validate the value with suggestion bean.
@param {Array} value
@param {String} bean to validate each item of the array with
@return {Boolean} | [
"Internal",
"method",
"to",
"validate",
"the",
"value",
"with",
"suggestion",
"bean",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiAutoCompleteController.js#L453-L462 | train |
|
ariatemplates/ariatemplates | src/aria/utils/dragdrop/Drag.js | function (logError) {
var handle = this.handle;
var cursor = this.cursor;
var element;
if (!handle) {
element = this.getElement(logError);
} else {
var typeUtils = ariaUtilsType;
if (typeUtils.isString(handle)) {
handle = ariaUtilsDom.getElementById(handle);
}
if (typeUtils.isHTMLElement(handle)) {
this.handle = handle;
element = handle;
} else if (logError === true) {
this.$logError(this.INVALID_ATTRIBUTE, ["handle", "params"]);
}
}
if (element) {
if (cursor) {
if (this.originalCursor == null) {
this.originalCursor = element.style.cursor;
}
element.style.cursor = cursor;
}
return element;
}
} | javascript | function (logError) {
var handle = this.handle;
var cursor = this.cursor;
var element;
if (!handle) {
element = this.getElement(logError);
} else {
var typeUtils = ariaUtilsType;
if (typeUtils.isString(handle)) {
handle = ariaUtilsDom.getElementById(handle);
}
if (typeUtils.isHTMLElement(handle)) {
this.handle = handle;
element = handle;
} else if (logError === true) {
this.$logError(this.INVALID_ATTRIBUTE, ["handle", "params"]);
}
}
if (element) {
if (cursor) {
if (this.originalCursor == null) {
this.originalCursor = element.style.cursor;
}
element.style.cursor = cursor;
}
return element;
}
} | [
"function",
"(",
"logError",
")",
"{",
"var",
"handle",
"=",
"this",
".",
"handle",
";",
"var",
"cursor",
"=",
"this",
".",
"cursor",
";",
"var",
"element",
";",
"if",
"(",
"!",
"handle",
")",
"{",
"element",
"=",
"this",
".",
"getElement",
"(",
"logError",
")",
";",
"}",
"else",
"{",
"var",
"typeUtils",
"=",
"ariaUtilsType",
";",
"if",
"(",
"typeUtils",
".",
"isString",
"(",
"handle",
")",
")",
"{",
"handle",
"=",
"ariaUtilsDom",
".",
"getElementById",
"(",
"handle",
")",
";",
"}",
"if",
"(",
"typeUtils",
".",
"isHTMLElement",
"(",
"handle",
")",
")",
"{",
"this",
".",
"handle",
"=",
"handle",
";",
"element",
"=",
"handle",
";",
"}",
"else",
"if",
"(",
"logError",
"===",
"true",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_ATTRIBUTE",
",",
"[",
"\"handle\"",
",",
"\"params\"",
"]",
")",
";",
"}",
"}",
"if",
"(",
"element",
")",
"{",
"if",
"(",
"cursor",
")",
"{",
"if",
"(",
"this",
".",
"originalCursor",
"==",
"null",
")",
"{",
"this",
".",
"originalCursor",
"=",
"element",
".",
"style",
".",
"cursor",
";",
"}",
"element",
".",
"style",
".",
"cursor",
"=",
"cursor",
";",
"}",
"return",
"element",
";",
"}",
"}"
]
| Get the element from which drag can start. This is the handle if specified or the draggable element
itself otherwise.
@param {Boolean} logError Whether an error should be logged when the draggable element is not found
@return {HTMLElement} | [
"Get",
"the",
"element",
"from",
"which",
"drag",
"can",
"start",
".",
"This",
"is",
"the",
"handle",
"if",
"specified",
"or",
"the",
"draggable",
"element",
"itself",
"otherwise",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/dragdrop/Drag.js#L245-L275 | train |
|
ariatemplates/ariatemplates | src/aria/utils/dragdrop/Drag.js | function (logError) {
var element = this.element;
if (!element) {
element = ariaUtilsDom.getElementById(this.id);
if (!element) {
if (logError === true) {
this.$logError(this.INVALID_ATTRIBUTE, ["id", "constructor"]);
}
return;
}
this.element = element;
}
return element;
} | javascript | function (logError) {
var element = this.element;
if (!element) {
element = ariaUtilsDom.getElementById(this.id);
if (!element) {
if (logError === true) {
this.$logError(this.INVALID_ATTRIBUTE, ["id", "constructor"]);
}
return;
}
this.element = element;
}
return element;
} | [
"function",
"(",
"logError",
")",
"{",
"var",
"element",
"=",
"this",
".",
"element",
";",
"if",
"(",
"!",
"element",
")",
"{",
"element",
"=",
"ariaUtilsDom",
".",
"getElementById",
"(",
"this",
".",
"id",
")",
";",
"if",
"(",
"!",
"element",
")",
"{",
"if",
"(",
"logError",
"===",
"true",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_ATTRIBUTE",
",",
"[",
"\"id\"",
",",
"\"constructor\"",
"]",
")",
";",
"}",
"return",
";",
"}",
"this",
".",
"element",
"=",
"element",
";",
"}",
"return",
"element",
";",
"}"
]
| Get the draggable element. This is the element that should be moved when drag ends.
@param {Boolean} logError Whether an error should be logged when the element is not found
@return {HTMLElement} | [
"Get",
"the",
"draggable",
"element",
".",
"This",
"is",
"the",
"element",
"that",
"should",
"be",
"moved",
"when",
"drag",
"ends",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/dragdrop/Drag.js#L282-L297 | train |
|
ariatemplates/ariatemplates | src/aria/utils/dragdrop/Drag.js | function (element) {
var position = ariaUtilsDom.getOffset(element);
this._elementInitialPosition = position;
var style = element.style;
style.position = "absolute";
style.left = position.left + "px";
style.top = position.top + "px";
} | javascript | function (element) {
var position = ariaUtilsDom.getOffset(element);
this._elementInitialPosition = position;
var style = element.style;
style.position = "absolute";
style.left = position.left + "px";
style.top = position.top + "px";
} | [
"function",
"(",
"element",
")",
"{",
"var",
"position",
"=",
"ariaUtilsDom",
".",
"getOffset",
"(",
"element",
")",
";",
"this",
".",
"_elementInitialPosition",
"=",
"position",
";",
"var",
"style",
"=",
"element",
".",
"style",
";",
"style",
".",
"position",
"=",
"\"absolute\"",
";",
"style",
".",
"left",
"=",
"position",
".",
"left",
"+",
"\"px\"",
";",
"style",
".",
"top",
"=",
"position",
".",
"top",
"+",
"\"px\"",
";",
"}"
]
| Compute the initial position of the element and set its style properties
@protected
@param {HTMLElement} element | [
"Compute",
"the",
"initial",
"position",
"of",
"the",
"element",
"and",
"set",
"its",
"style",
"properties"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/dragdrop/Drag.js#L304-L313 | train |
|
ariatemplates/ariatemplates | src/aria/utils/dragdrop/Drag.js | function (create) {
var proxy = this.proxy;
if (proxy) {
return proxy.overlay;
}
var params = this.params, config = params.proxy;
if (config) {
var classpath = "aria.utils.overlay." + config.type;
Aria.load({
classes : [classpath],
oncomplete : create === false ? null : {
fn : this._createProxy,
scope : this,
args : {
classpath : classpath,
cfg : config.cfg
}
},
onerror : {
fn : function () {
this.$logError(this.INVALID_ATTRIBUTE, ["proxy", "params"]);
},
scope : this,
override : true
}
});
// Aria.load might be synchronous and this.proxy could be already available here
if (create !== false && !this.proxy) {
// this won't cause another Aria.load on next move if the proxy is not ready
this.proxy = {};
}
if (this.proxy) {
return this.proxy.overlay;
} else {
return this.proxy;
}
} else {
return this.getElement();
}
} | javascript | function (create) {
var proxy = this.proxy;
if (proxy) {
return proxy.overlay;
}
var params = this.params, config = params.proxy;
if (config) {
var classpath = "aria.utils.overlay." + config.type;
Aria.load({
classes : [classpath],
oncomplete : create === false ? null : {
fn : this._createProxy,
scope : this,
args : {
classpath : classpath,
cfg : config.cfg
}
},
onerror : {
fn : function () {
this.$logError(this.INVALID_ATTRIBUTE, ["proxy", "params"]);
},
scope : this,
override : true
}
});
// Aria.load might be synchronous and this.proxy could be already available here
if (create !== false && !this.proxy) {
// this won't cause another Aria.load on next move if the proxy is not ready
this.proxy = {};
}
if (this.proxy) {
return this.proxy.overlay;
} else {
return this.proxy;
}
} else {
return this.getElement();
}
} | [
"function",
"(",
"create",
")",
"{",
"var",
"proxy",
"=",
"this",
".",
"proxy",
";",
"if",
"(",
"proxy",
")",
"{",
"return",
"proxy",
".",
"overlay",
";",
"}",
"var",
"params",
"=",
"this",
".",
"params",
",",
"config",
"=",
"params",
".",
"proxy",
";",
"if",
"(",
"config",
")",
"{",
"var",
"classpath",
"=",
"\"aria.utils.overlay.\"",
"+",
"config",
".",
"type",
";",
"Aria",
".",
"load",
"(",
"{",
"classes",
":",
"[",
"classpath",
"]",
",",
"oncomplete",
":",
"create",
"===",
"false",
"?",
"null",
":",
"{",
"fn",
":",
"this",
".",
"_createProxy",
",",
"scope",
":",
"this",
",",
"args",
":",
"{",
"classpath",
":",
"classpath",
",",
"cfg",
":",
"config",
".",
"cfg",
"}",
"}",
",",
"onerror",
":",
"{",
"fn",
":",
"function",
"(",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_ATTRIBUTE",
",",
"[",
"\"proxy\"",
",",
"\"params\"",
"]",
")",
";",
"}",
",",
"scope",
":",
"this",
",",
"override",
":",
"true",
"}",
"}",
")",
";",
"if",
"(",
"create",
"!==",
"false",
"&&",
"!",
"this",
".",
"proxy",
")",
"{",
"this",
".",
"proxy",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"this",
".",
"proxy",
")",
"{",
"return",
"this",
".",
"proxy",
".",
"overlay",
";",
"}",
"else",
"{",
"return",
"this",
".",
"proxy",
";",
"}",
"}",
"else",
"{",
"return",
"this",
".",
"getElement",
"(",
")",
";",
"}",
"}"
]
| Get the element that moves on every mouse move. This is the proxy if specified or the draggable element
itself otherwise.
@param {Boolean} create Whether to create or not the proxy as soon as it's class is loaded. Default true
@return {HTMLElement} or undefined if the movable element is not ready yet | [
"Get",
"the",
"element",
"that",
"moves",
"on",
"every",
"mouse",
"move",
".",
"This",
"is",
"the",
"proxy",
"if",
"specified",
"or",
"the",
"draggable",
"element",
"itself",
"otherwise",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/dragdrop/Drag.js#L321-L362 | train |
|
ariatemplates/ariatemplates | src/aria/utils/dragdrop/Drag.js | function (coord) {
this.posX = coord.x;
this.posY = coord.y;
this._mouseInitialPosition = {
left : coord.x,
top : coord.y
};
var element = this.getElement(true), domUtil = ariaUtilsDom;
// This will prevent text selection on IE on the element
element.onselectstart = Aria.returnFalse;
this._setElementStyle(element);
this._setBoundary();
var movable = this.getMovable();
if (movable) {
// This will prevent text selection on IE on the movable
movable.onselectstart = Aria.returnFalse;
if (this.dragOverIFrame) {
// add overlay here for the visible page
this.overlay = new aria.utils.overlay.Overlay(document.body, {
className : ' '
});
}
this._movableInitialGeometry = domUtil.getGeometry(movable);
this._movableGeometry = ariaUtilsJson.copy(this._movableInitialGeometry);
var offset = domUtil.getOffset(movable);
this._baseMovableOffset = {
left : this._movableGeometry.x - offset.left,
top : this._movableGeometry.y - offset.top
};
this.$raiseEvent("dragstart");
}
} | javascript | function (coord) {
this.posX = coord.x;
this.posY = coord.y;
this._mouseInitialPosition = {
left : coord.x,
top : coord.y
};
var element = this.getElement(true), domUtil = ariaUtilsDom;
// This will prevent text selection on IE on the element
element.onselectstart = Aria.returnFalse;
this._setElementStyle(element);
this._setBoundary();
var movable = this.getMovable();
if (movable) {
// This will prevent text selection on IE on the movable
movable.onselectstart = Aria.returnFalse;
if (this.dragOverIFrame) {
// add overlay here for the visible page
this.overlay = new aria.utils.overlay.Overlay(document.body, {
className : ' '
});
}
this._movableInitialGeometry = domUtil.getGeometry(movable);
this._movableGeometry = ariaUtilsJson.copy(this._movableInitialGeometry);
var offset = domUtil.getOffset(movable);
this._baseMovableOffset = {
left : this._movableGeometry.x - offset.left,
top : this._movableGeometry.y - offset.top
};
this.$raiseEvent("dragstart");
}
} | [
"function",
"(",
"coord",
")",
"{",
"this",
".",
"posX",
"=",
"coord",
".",
"x",
";",
"this",
".",
"posY",
"=",
"coord",
".",
"y",
";",
"this",
".",
"_mouseInitialPosition",
"=",
"{",
"left",
":",
"coord",
".",
"x",
",",
"top",
":",
"coord",
".",
"y",
"}",
";",
"var",
"element",
"=",
"this",
".",
"getElement",
"(",
"true",
")",
",",
"domUtil",
"=",
"ariaUtilsDom",
";",
"element",
".",
"onselectstart",
"=",
"Aria",
".",
"returnFalse",
";",
"this",
".",
"_setElementStyle",
"(",
"element",
")",
";",
"this",
".",
"_setBoundary",
"(",
")",
";",
"var",
"movable",
"=",
"this",
".",
"getMovable",
"(",
")",
";",
"if",
"(",
"movable",
")",
"{",
"movable",
".",
"onselectstart",
"=",
"Aria",
".",
"returnFalse",
";",
"if",
"(",
"this",
".",
"dragOverIFrame",
")",
"{",
"this",
".",
"overlay",
"=",
"new",
"aria",
".",
"utils",
".",
"overlay",
".",
"Overlay",
"(",
"document",
".",
"body",
",",
"{",
"className",
":",
"' '",
"}",
")",
";",
"}",
"this",
".",
"_movableInitialGeometry",
"=",
"domUtil",
".",
"getGeometry",
"(",
"movable",
")",
";",
"this",
".",
"_movableGeometry",
"=",
"ariaUtilsJson",
".",
"copy",
"(",
"this",
".",
"_movableInitialGeometry",
")",
";",
"var",
"offset",
"=",
"domUtil",
".",
"getOffset",
"(",
"movable",
")",
";",
"this",
".",
"_baseMovableOffset",
"=",
"{",
"left",
":",
"this",
".",
"_movableGeometry",
".",
"x",
"-",
"offset",
".",
"left",
",",
"top",
":",
"this",
".",
"_movableGeometry",
".",
"y",
"-",
"offset",
".",
"top",
"}",
";",
"this",
".",
"$raiseEvent",
"(",
"\"dragstart\"",
")",
";",
"}",
"}"
]
| Handle the drag start. Initialize some reference geometries and raise the dragstart event
@param {Object} coord Contains the x and y coordinates of the mouse when a drag start has been detected | [
"Handle",
"the",
"drag",
"start",
".",
"Initialize",
"some",
"reference",
"geometries",
"and",
"raise",
"the",
"dragstart",
"event"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/dragdrop/Drag.js#L392-L423 | train |
|
ariatemplates/ariatemplates | src/aria/utils/dragdrop/Drag.js | function (evt) {
var movable = this.getMovable();
var domUtil = ariaUtilsDom;
if (movable && movable.style) {
var geometry = ariaUtilsJson.copy(this._movableGeometry);
var mouseInitPos = this._mouseInitialPosition;
var movableInitPos = this._movableInitialGeometry;
if (!this._vertical) {
geometry.x = movableInitPos.x + evt.clientX - mouseInitPos.left;
}
if (!this._horizontal) {
geometry.y = movableInitPos.y + evt.clientY - mouseInitPos.top;
}
var pos = (this._boundary) ? domUtil.fitInside(geometry, this._boundary) : {
top : geometry.y,
left : geometry.x
};
movable.style.top = (pos.top - this._baseMovableOffset.top) + "px";
movable.style.left = (pos.left - this._baseMovableOffset.left) + "px";
geometry.y = pos.top;
geometry.x = pos.left;
this.posY = mouseInitPos.top + geometry.y - movableInitPos.y;
this.posX = mouseInitPos.left + geometry.x - movableInitPos.x;
this._movableGeometry = geometry;
this.$raiseEvent("move");
}
} | javascript | function (evt) {
var movable = this.getMovable();
var domUtil = ariaUtilsDom;
if (movable && movable.style) {
var geometry = ariaUtilsJson.copy(this._movableGeometry);
var mouseInitPos = this._mouseInitialPosition;
var movableInitPos = this._movableInitialGeometry;
if (!this._vertical) {
geometry.x = movableInitPos.x + evt.clientX - mouseInitPos.left;
}
if (!this._horizontal) {
geometry.y = movableInitPos.y + evt.clientY - mouseInitPos.top;
}
var pos = (this._boundary) ? domUtil.fitInside(geometry, this._boundary) : {
top : geometry.y,
left : geometry.x
};
movable.style.top = (pos.top - this._baseMovableOffset.top) + "px";
movable.style.left = (pos.left - this._baseMovableOffset.left) + "px";
geometry.y = pos.top;
geometry.x = pos.left;
this.posY = mouseInitPos.top + geometry.y - movableInitPos.y;
this.posX = mouseInitPos.left + geometry.x - movableInitPos.x;
this._movableGeometry = geometry;
this.$raiseEvent("move");
}
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"movable",
"=",
"this",
".",
"getMovable",
"(",
")",
";",
"var",
"domUtil",
"=",
"ariaUtilsDom",
";",
"if",
"(",
"movable",
"&&",
"movable",
".",
"style",
")",
"{",
"var",
"geometry",
"=",
"ariaUtilsJson",
".",
"copy",
"(",
"this",
".",
"_movableGeometry",
")",
";",
"var",
"mouseInitPos",
"=",
"this",
".",
"_mouseInitialPosition",
";",
"var",
"movableInitPos",
"=",
"this",
".",
"_movableInitialGeometry",
";",
"if",
"(",
"!",
"this",
".",
"_vertical",
")",
"{",
"geometry",
".",
"x",
"=",
"movableInitPos",
".",
"x",
"+",
"evt",
".",
"clientX",
"-",
"mouseInitPos",
".",
"left",
";",
"}",
"if",
"(",
"!",
"this",
".",
"_horizontal",
")",
"{",
"geometry",
".",
"y",
"=",
"movableInitPos",
".",
"y",
"+",
"evt",
".",
"clientY",
"-",
"mouseInitPos",
".",
"top",
";",
"}",
"var",
"pos",
"=",
"(",
"this",
".",
"_boundary",
")",
"?",
"domUtil",
".",
"fitInside",
"(",
"geometry",
",",
"this",
".",
"_boundary",
")",
":",
"{",
"top",
":",
"geometry",
".",
"y",
",",
"left",
":",
"geometry",
".",
"x",
"}",
";",
"movable",
".",
"style",
".",
"top",
"=",
"(",
"pos",
".",
"top",
"-",
"this",
".",
"_baseMovableOffset",
".",
"top",
")",
"+",
"\"px\"",
";",
"movable",
".",
"style",
".",
"left",
"=",
"(",
"pos",
".",
"left",
"-",
"this",
".",
"_baseMovableOffset",
".",
"left",
")",
"+",
"\"px\"",
";",
"geometry",
".",
"y",
"=",
"pos",
".",
"top",
";",
"geometry",
".",
"x",
"=",
"pos",
".",
"left",
";",
"this",
".",
"posY",
"=",
"mouseInitPos",
".",
"top",
"+",
"geometry",
".",
"y",
"-",
"movableInitPos",
".",
"y",
";",
"this",
".",
"posX",
"=",
"mouseInitPos",
".",
"left",
"+",
"geometry",
".",
"x",
"-",
"movableInitPos",
".",
"x",
";",
"this",
".",
"_movableGeometry",
"=",
"geometry",
";",
"this",
".",
"$raiseEvent",
"(",
"\"move\"",
")",
";",
"}",
"}"
]
| Handle the mouse move during a drag by setting the correct position on the movable element. Raise the
move event
@param {aria.DomEvent} evt | [
"Handle",
"the",
"mouse",
"move",
"during",
"a",
"drag",
"by",
"setting",
"the",
"correct",
"position",
"on",
"the",
"movable",
"element",
".",
"Raise",
"the",
"move",
"event"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/dragdrop/Drag.js#L430-L460 | train |
|
ariatemplates/ariatemplates | src/aria/utils/dragdrop/Drag.js | function () {
var element = this.getElement();
// This is to handle if there is a scroll
element.onselectstart = Aria.returnTrue;
if (this.overlay) {
// remove overlay here
this.overlay.$dispose();
this.overlay = null;
}
if (this.proxy && this.proxy.overlay) {
element.style.top = (this._elementInitialPosition.top + this._movableGeometry.y - this._movableInitialGeometry.y)
+ "px";
element.style.left = (this._elementInitialPosition.left + this._movableGeometry.x - this._movableInitialGeometry.x)
+ "px";
this.proxy.$dispose();
this.proxy = null;
}
this.$raiseEvent("dragend");
} | javascript | function () {
var element = this.getElement();
// This is to handle if there is a scroll
element.onselectstart = Aria.returnTrue;
if (this.overlay) {
// remove overlay here
this.overlay.$dispose();
this.overlay = null;
}
if (this.proxy && this.proxy.overlay) {
element.style.top = (this._elementInitialPosition.top + this._movableGeometry.y - this._movableInitialGeometry.y)
+ "px";
element.style.left = (this._elementInitialPosition.left + this._movableGeometry.x - this._movableInitialGeometry.x)
+ "px";
this.proxy.$dispose();
this.proxy = null;
}
this.$raiseEvent("dragend");
} | [
"function",
"(",
")",
"{",
"var",
"element",
"=",
"this",
".",
"getElement",
"(",
")",
";",
"element",
".",
"onselectstart",
"=",
"Aria",
".",
"returnTrue",
";",
"if",
"(",
"this",
".",
"overlay",
")",
"{",
"this",
".",
"overlay",
".",
"$dispose",
"(",
")",
";",
"this",
".",
"overlay",
"=",
"null",
";",
"}",
"if",
"(",
"this",
".",
"proxy",
"&&",
"this",
".",
"proxy",
".",
"overlay",
")",
"{",
"element",
".",
"style",
".",
"top",
"=",
"(",
"this",
".",
"_elementInitialPosition",
".",
"top",
"+",
"this",
".",
"_movableGeometry",
".",
"y",
"-",
"this",
".",
"_movableInitialGeometry",
".",
"y",
")",
"+",
"\"px\"",
";",
"element",
".",
"style",
".",
"left",
"=",
"(",
"this",
".",
"_elementInitialPosition",
".",
"left",
"+",
"this",
".",
"_movableGeometry",
".",
"x",
"-",
"this",
".",
"_movableInitialGeometry",
".",
"x",
")",
"+",
"\"px\"",
";",
"this",
".",
"proxy",
".",
"$dispose",
"(",
")",
";",
"this",
".",
"proxy",
"=",
"null",
";",
"}",
"this",
".",
"$raiseEvent",
"(",
"\"dragend\"",
")",
";",
"}"
]
| Handle the drag end. Apply the correct positioning to the draggable element | [
"Handle",
"the",
"drag",
"end",
".",
"Apply",
"the",
"correct",
"positioning",
"to",
"the",
"draggable",
"element"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/dragdrop/Drag.js#L465-L484 | train |
|
ariatemplates/ariatemplates | src/aria/utils/dragdrop/Drag.js | function () {
var constrainTo = this.params.constrainTo, domUtil = ariaUtilsDom;
if (!constrainTo || constrainTo === domUtil.VIEWPORT) {
this._boundary = constrainTo;
return;
}
if (ariaUtilsType.isString(constrainTo)) {
constrainTo = domUtil.getElementById(constrainTo);
}
if (constrainTo) {
this._boundary = ariaUtilsDom.getClientGeometry(constrainTo);
return;
}
this._boundary = null;
this.$logError(this.INVALID_ATTRIBUTE, ["constrainTo", "params"]);
} | javascript | function () {
var constrainTo = this.params.constrainTo, domUtil = ariaUtilsDom;
if (!constrainTo || constrainTo === domUtil.VIEWPORT) {
this._boundary = constrainTo;
return;
}
if (ariaUtilsType.isString(constrainTo)) {
constrainTo = domUtil.getElementById(constrainTo);
}
if (constrainTo) {
this._boundary = ariaUtilsDom.getClientGeometry(constrainTo);
return;
}
this._boundary = null;
this.$logError(this.INVALID_ATTRIBUTE, ["constrainTo", "params"]);
} | [
"function",
"(",
")",
"{",
"var",
"constrainTo",
"=",
"this",
".",
"params",
".",
"constrainTo",
",",
"domUtil",
"=",
"ariaUtilsDom",
";",
"if",
"(",
"!",
"constrainTo",
"||",
"constrainTo",
"===",
"domUtil",
".",
"VIEWPORT",
")",
"{",
"this",
".",
"_boundary",
"=",
"constrainTo",
";",
"return",
";",
"}",
"if",
"(",
"ariaUtilsType",
".",
"isString",
"(",
"constrainTo",
")",
")",
"{",
"constrainTo",
"=",
"domUtil",
".",
"getElementById",
"(",
"constrainTo",
")",
";",
"}",
"if",
"(",
"constrainTo",
")",
"{",
"this",
".",
"_boundary",
"=",
"ariaUtilsDom",
".",
"getClientGeometry",
"(",
"constrainTo",
")",
";",
"return",
";",
"}",
"this",
".",
"_boundary",
"=",
"null",
";",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_ATTRIBUTE",
",",
"[",
"\"constrainTo\"",
",",
"\"params\"",
"]",
")",
";",
"}"
]
| Compute the geometry of the element to which the draggable element is constrained
@protected | [
"Compute",
"the",
"geometry",
"of",
"the",
"element",
"to",
"which",
"the",
"draggable",
"element",
"is",
"constrained"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/dragdrop/Drag.js#L490-L507 | train |
|
ariatemplates/ariatemplates | src/aria/html/Template.js | function (cfg) {
var jsonValidator = ariaCoreJsonValidator;
this._cfgOk = jsonValidator.validateCfg("aria.html.beans.TemplateCfg.Properties", cfg);
if (this._needCreatingModuleCtrl) {
this._cfgOk = this._cfgOk
&& jsonValidator.validateCfg("aria.templates.CfgBeans.InitModuleCtrl", cfg.moduleCtrl);
}
} | javascript | function (cfg) {
var jsonValidator = ariaCoreJsonValidator;
this._cfgOk = jsonValidator.validateCfg("aria.html.beans.TemplateCfg.Properties", cfg);
if (this._needCreatingModuleCtrl) {
this._cfgOk = this._cfgOk
&& jsonValidator.validateCfg("aria.templates.CfgBeans.InitModuleCtrl", cfg.moduleCtrl);
}
} | [
"function",
"(",
"cfg",
")",
"{",
"var",
"jsonValidator",
"=",
"ariaCoreJsonValidator",
";",
"this",
".",
"_cfgOk",
"=",
"jsonValidator",
".",
"validateCfg",
"(",
"\"aria.html.beans.TemplateCfg.Properties\"",
",",
"cfg",
")",
";",
"if",
"(",
"this",
".",
"_needCreatingModuleCtrl",
")",
"{",
"this",
".",
"_cfgOk",
"=",
"this",
".",
"_cfgOk",
"&&",
"jsonValidator",
".",
"validateCfg",
"(",
"\"aria.templates.CfgBeans.InitModuleCtrl\"",
",",
"cfg",
".",
"moduleCtrl",
")",
";",
"}",
"}"
]
| Internal function called before markup generation to check the widget configuration consistency | [
"Internal",
"function",
"called",
"before",
"markup",
"generation",
"to",
"check",
"the",
"widget",
"configuration",
"consistency"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Template.js#L148-L156 | train |
|
ariatemplates/ariatemplates | src/aria/widgetLibs/WidgetLib.js | function (widgetName, includeLoaded) {
var classpath = this.widgets[widgetName];
if (classpath == null) {
return null;
}
if (includeLoaded || Aria.getClassRef(classpath) == null) {
return [classpath];
}
return [];
} | javascript | function (widgetName, includeLoaded) {
var classpath = this.widgets[widgetName];
if (classpath == null) {
return null;
}
if (includeLoaded || Aria.getClassRef(classpath) == null) {
return [classpath];
}
return [];
} | [
"function",
"(",
"widgetName",
",",
"includeLoaded",
")",
"{",
"var",
"classpath",
"=",
"this",
".",
"widgets",
"[",
"widgetName",
"]",
";",
"if",
"(",
"classpath",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"includeLoaded",
"||",
"Aria",
".",
"getClassRef",
"(",
"classpath",
")",
"==",
"null",
")",
"{",
"return",
"[",
"classpath",
"]",
";",
"}",
"return",
"[",
"]",
";",
"}"
]
| Return a list of dependencies which must be loaded before a widget can be used.
@param {String} widgetName the name of the widget - e.g. TextField
@param {Boolean} includeLoaded [optional, default: false] if true, also include dependencies which are
already loaded
@return {Array} array of classpaths which should be loaded so that the widget can be used. Must return null
if the widget does not exist. Return an empty array if the widget is already usable and includeLoaded is
false. | [
"Return",
"a",
"list",
"of",
"dependencies",
"which",
"must",
"be",
"loaded",
"before",
"a",
"widget",
"can",
"be",
"used",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgetLibs/WidgetLib.js#L45-L54 | train |
|
ariatemplates/ariatemplates | src/aria/widgetLibs/WidgetLib.js | function (widgetName, out, cfg, lineNbr) {
var classpath = this.widgets[widgetName];
try {
if (classpath) {
// default object if cfg was null
if (!cfg) {
cfg = {};
}
var widgetClass = Aria.getClassRef(classpath);
var instance = new widgetClass(cfg, out.tplCtxt, lineNbr);
out.registerBehavior(instance);
instance.writeMarkupBegin(out);
return instance;
} else {
// This should normally never happen, as the error will probably be caught after the call
// of getWidgetDependencies by the TplClassGenerator (see the "@" statement in
// aria.templates.Statements).
throw this.UNKWOWN_WIDGET;
}
} catch (error) {
out.write("#Error in widget:" + widgetName + "#");
this.$logError(this.ERROR_WIDGET_INIT, [out.tplCtxt.tplClasspath, lineNbr, widgetName,
"writeMarkupBegin"], error);
}
} | javascript | function (widgetName, out, cfg, lineNbr) {
var classpath = this.widgets[widgetName];
try {
if (classpath) {
// default object if cfg was null
if (!cfg) {
cfg = {};
}
var widgetClass = Aria.getClassRef(classpath);
var instance = new widgetClass(cfg, out.tplCtxt, lineNbr);
out.registerBehavior(instance);
instance.writeMarkupBegin(out);
return instance;
} else {
// This should normally never happen, as the error will probably be caught after the call
// of getWidgetDependencies by the TplClassGenerator (see the "@" statement in
// aria.templates.Statements).
throw this.UNKWOWN_WIDGET;
}
} catch (error) {
out.write("#Error in widget:" + widgetName + "#");
this.$logError(this.ERROR_WIDGET_INIT, [out.tplCtxt.tplClasspath, lineNbr, widgetName,
"writeMarkupBegin"], error);
}
} | [
"function",
"(",
"widgetName",
",",
"out",
",",
"cfg",
",",
"lineNbr",
")",
"{",
"var",
"classpath",
"=",
"this",
".",
"widgets",
"[",
"widgetName",
"]",
";",
"try",
"{",
"if",
"(",
"classpath",
")",
"{",
"if",
"(",
"!",
"cfg",
")",
"{",
"cfg",
"=",
"{",
"}",
";",
"}",
"var",
"widgetClass",
"=",
"Aria",
".",
"getClassRef",
"(",
"classpath",
")",
";",
"var",
"instance",
"=",
"new",
"widgetClass",
"(",
"cfg",
",",
"out",
".",
"tplCtxt",
",",
"lineNbr",
")",
";",
"out",
".",
"registerBehavior",
"(",
"instance",
")",
";",
"instance",
".",
"writeMarkupBegin",
"(",
"out",
")",
";",
"return",
"instance",
";",
"}",
"else",
"{",
"throw",
"this",
".",
"UNKWOWN_WIDGET",
";",
"}",
"}",
"catch",
"(",
"error",
")",
"{",
"out",
".",
"write",
"(",
"\"#Error in widget:\"",
"+",
"widgetName",
"+",
"\"#\"",
")",
";",
"this",
".",
"$logError",
"(",
"this",
".",
"ERROR_WIDGET_INIT",
",",
"[",
"out",
".",
"tplCtxt",
".",
"tplClasspath",
",",
"lineNbr",
",",
"widgetName",
",",
"\"writeMarkupBegin\"",
"]",
",",
"error",
")",
";",
"}",
"}"
]
| Function called by the template engine to process a container widget markup
@param {String} widgetName the name of the widget - e.g. TextField
@param {aria.templates.MarkupWriter} out the output writer
@param {Object} cfg
@param {Number} lineNbr line number of the widget in the template | [
"Function",
"called",
"by",
"the",
"template",
"engine",
"to",
"process",
"a",
"container",
"widget",
"markup"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgetLibs/WidgetLib.js#L94-L118 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonTypesCheck.js | function (baseType, args) {
jv._logError(jv.INVALID_TYPE_VALUE, [baseType.typeName, args.beanDef[jv._MD_TYPENAME], args.value, args.path]);
} | javascript | function (baseType, args) {
jv._logError(jv.INVALID_TYPE_VALUE, [baseType.typeName, args.beanDef[jv._MD_TYPENAME], args.value, args.path]);
} | [
"function",
"(",
"baseType",
",",
"args",
")",
"{",
"jv",
".",
"_logError",
"(",
"jv",
".",
"INVALID_TYPE_VALUE",
",",
"[",
"baseType",
".",
"typeName",
",",
"args",
".",
"beanDef",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
",",
"args",
".",
"value",
",",
"args",
".",
"path",
"]",
")",
";",
"}"
]
| Utility function which logs a bad type error.
@private
@param {Object} baseType
@param {Object} args | [
"Utility",
"function",
"which",
"logs",
"a",
"bad",
"type",
"error",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonTypesCheck.js#L35-L37 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonTypesCheck.js | function (parentType, childType) {
if (!jv._options.checkInheritance) {
return true;
}
var typeRef = childType;
while (!typeRef[jv._MD_BUILTIN]) {
if (parentType == typeRef) {
return true;
}
typeRef = typeRef[jv._MD_PARENTDEF];
}
jv._logError(jv.INHERITANCE_EXPECTED, [childType[jv._MD_TYPENAME], parentType[jv._MD_TYPENAME]]);
return false;
} | javascript | function (parentType, childType) {
if (!jv._options.checkInheritance) {
return true;
}
var typeRef = childType;
while (!typeRef[jv._MD_BUILTIN]) {
if (parentType == typeRef) {
return true;
}
typeRef = typeRef[jv._MD_PARENTDEF];
}
jv._logError(jv.INHERITANCE_EXPECTED, [childType[jv._MD_TYPENAME], parentType[jv._MD_TYPENAME]]);
return false;
} | [
"function",
"(",
"parentType",
",",
"childType",
")",
"{",
"if",
"(",
"!",
"jv",
".",
"_options",
".",
"checkInheritance",
")",
"{",
"return",
"true",
";",
"}",
"var",
"typeRef",
"=",
"childType",
";",
"while",
"(",
"!",
"typeRef",
"[",
"jv",
".",
"_MD_BUILTIN",
"]",
")",
"{",
"if",
"(",
"parentType",
"==",
"typeRef",
")",
"{",
"return",
"true",
";",
"}",
"typeRef",
"=",
"typeRef",
"[",
"jv",
".",
"_MD_PARENTDEF",
"]",
";",
"}",
"jv",
".",
"_logError",
"(",
"jv",
".",
"INHERITANCE_EXPECTED",
",",
"[",
"childType",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
",",
"parentType",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
"]",
")",
";",
"return",
"false",
";",
"}"
]
| Check that childType inherits from parentType and log any error.
@private | [
"Check",
"that",
"childType",
"inherits",
"from",
"parentType",
"and",
"log",
"any",
"error",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonTypesCheck.js#L43-L56 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonTypesCheck.js | function (beanDef, beanName, packageDef) {
var contentType = beanDef.$contentType;
var parentContentType = null;
var parent = beanDef[jv._MD_PARENTDEF];
if (!parent[jv._MD_BUILTIN]) {
parentContentType = parent.$contentType;
if (contentType == null) {
beanDef.$contentType = parentContentType;
return;
}
} else if (contentType == null) {
jv._logError(jv.MISSING_CONTENTTYPE, [beanDef[jv._MD_BASETYPE].typeName, beanDef[jv._MD_TYPENAME]]);
beanDef[jv._MD_BASETYPE] = jv._typeError;
return;
}
jv._preprocessBean(contentType, beanName + ".$contentType", packageDef);
if (parentContentType != null) {
__checkInheritance(parentContentType, contentType);
}
} | javascript | function (beanDef, beanName, packageDef) {
var contentType = beanDef.$contentType;
var parentContentType = null;
var parent = beanDef[jv._MD_PARENTDEF];
if (!parent[jv._MD_BUILTIN]) {
parentContentType = parent.$contentType;
if (contentType == null) {
beanDef.$contentType = parentContentType;
return;
}
} else if (contentType == null) {
jv._logError(jv.MISSING_CONTENTTYPE, [beanDef[jv._MD_BASETYPE].typeName, beanDef[jv._MD_TYPENAME]]);
beanDef[jv._MD_BASETYPE] = jv._typeError;
return;
}
jv._preprocessBean(contentType, beanName + ".$contentType", packageDef);
if (parentContentType != null) {
__checkInheritance(parentContentType, contentType);
}
} | [
"function",
"(",
"beanDef",
",",
"beanName",
",",
"packageDef",
")",
"{",
"var",
"contentType",
"=",
"beanDef",
".",
"$contentType",
";",
"var",
"parentContentType",
"=",
"null",
";",
"var",
"parent",
"=",
"beanDef",
"[",
"jv",
".",
"_MD_PARENTDEF",
"]",
";",
"if",
"(",
"!",
"parent",
"[",
"jv",
".",
"_MD_BUILTIN",
"]",
")",
"{",
"parentContentType",
"=",
"parent",
".",
"$contentType",
";",
"if",
"(",
"contentType",
"==",
"null",
")",
"{",
"beanDef",
".",
"$contentType",
"=",
"parentContentType",
";",
"return",
";",
"}",
"}",
"else",
"if",
"(",
"contentType",
"==",
"null",
")",
"{",
"jv",
".",
"_logError",
"(",
"jv",
".",
"MISSING_CONTENTTYPE",
",",
"[",
"beanDef",
"[",
"jv",
".",
"_MD_BASETYPE",
"]",
".",
"typeName",
",",
"beanDef",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
"]",
")",
";",
"beanDef",
"[",
"jv",
".",
"_MD_BASETYPE",
"]",
"=",
"jv",
".",
"_typeError",
";",
"return",
";",
"}",
"jv",
".",
"_preprocessBean",
"(",
"contentType",
",",
"beanName",
"+",
"\".$contentType\"",
",",
"packageDef",
")",
";",
"if",
"(",
"parentContentType",
"!=",
"null",
")",
"{",
"__checkInheritance",
"(",
"parentContentType",
",",
"contentType",
")",
";",
"}",
"}"
]
| Preprocess the content type of the given bean definition
@private
@param {aria.core.BaseTypes:Bean} beanDef bean to be preprocessed
@param {String} beanName fully qualified name for this bean
@param {aria.core.BaseTypes:Package} packageDef reference package | [
"Preprocess",
"the",
"content",
"type",
"of",
"the",
"given",
"bean",
"definition"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonTypesCheck.js#L65-L84 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonTypesCheck.js | function (beanDef, beanName, packageDef) {
var keyType = beanDef.$keyType;
var parentKeyType = null;
var parent = beanDef[jv._MD_PARENTDEF];
if (!parent[jv._MD_BUILTIN]) {
parentKeyType = parent.$keyType;
if (keyType == null) {
beanDef.$keyType = parentKeyType;
return;
}
} else if (keyType == null) {
// keyType not specified
return;
}
jv._preprocessBean(keyType, beanName + ".$keyType", packageDef);
if (parentKeyType != null) {
__checkInheritance(parentKeyType, keyType);
}
// in all cases, keyType must be a sub-type of aria.core.JsonTypes.String
if (keyType[jv._MD_BASETYPE].typeName != "String") {
jv._logError(jv.INHERITANCE_EXPECTED, [keyType[jv._MD_TYPENAME], jv._BASE_TYPES_PACKAGE + ".String"]);
return;
}
} | javascript | function (beanDef, beanName, packageDef) {
var keyType = beanDef.$keyType;
var parentKeyType = null;
var parent = beanDef[jv._MD_PARENTDEF];
if (!parent[jv._MD_BUILTIN]) {
parentKeyType = parent.$keyType;
if (keyType == null) {
beanDef.$keyType = parentKeyType;
return;
}
} else if (keyType == null) {
// keyType not specified
return;
}
jv._preprocessBean(keyType, beanName + ".$keyType", packageDef);
if (parentKeyType != null) {
__checkInheritance(parentKeyType, keyType);
}
// in all cases, keyType must be a sub-type of aria.core.JsonTypes.String
if (keyType[jv._MD_BASETYPE].typeName != "String") {
jv._logError(jv.INHERITANCE_EXPECTED, [keyType[jv._MD_TYPENAME], jv._BASE_TYPES_PACKAGE + ".String"]);
return;
}
} | [
"function",
"(",
"beanDef",
",",
"beanName",
",",
"packageDef",
")",
"{",
"var",
"keyType",
"=",
"beanDef",
".",
"$keyType",
";",
"var",
"parentKeyType",
"=",
"null",
";",
"var",
"parent",
"=",
"beanDef",
"[",
"jv",
".",
"_MD_PARENTDEF",
"]",
";",
"if",
"(",
"!",
"parent",
"[",
"jv",
".",
"_MD_BUILTIN",
"]",
")",
"{",
"parentKeyType",
"=",
"parent",
".",
"$keyType",
";",
"if",
"(",
"keyType",
"==",
"null",
")",
"{",
"beanDef",
".",
"$keyType",
"=",
"parentKeyType",
";",
"return",
";",
"}",
"}",
"else",
"if",
"(",
"keyType",
"==",
"null",
")",
"{",
"return",
";",
"}",
"jv",
".",
"_preprocessBean",
"(",
"keyType",
",",
"beanName",
"+",
"\".$keyType\"",
",",
"packageDef",
")",
";",
"if",
"(",
"parentKeyType",
"!=",
"null",
")",
"{",
"__checkInheritance",
"(",
"parentKeyType",
",",
"keyType",
")",
";",
"}",
"if",
"(",
"keyType",
"[",
"jv",
".",
"_MD_BASETYPE",
"]",
".",
"typeName",
"!=",
"\"String\"",
")",
"{",
"jv",
".",
"_logError",
"(",
"jv",
".",
"INHERITANCE_EXPECTED",
",",
"[",
"keyType",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
",",
"jv",
".",
"_BASE_TYPES_PACKAGE",
"+",
"\".String\"",
"]",
")",
";",
"return",
";",
"}",
"}"
]
| Preprocess the key type of the given bean definition
@private
@param {aria.core.BaseTypes:Bean} beanDef bean to be preprocessed
@param {String} beanName fully qualified name for this bean
@param {aria.core.BaseTypes:Package} packageDef reference package | [
"Preprocess",
"the",
"key",
"type",
"of",
"the",
"given",
"bean",
"definition"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonTypesCheck.js#L93-L116 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonTypesCheck.js | function (args) {
if (typeof(args.value) != 'string') {
return __badTypeError(this, args); // this refers to the correct object (a base type)
}
var beanDef = args.beanDef;
while (!beanDef[jv._MD_BUILTIN]) {
var regexp = beanDef.$regExp;
if (regexp != null) {
if (!regexp.test(args.value)) {
return jv._logError(jv.REGEXP_FAILED, [args.value, args.path, regexp, beanDef[jv._MD_TYPENAME]]);
}
}
beanDef = beanDef[jv._MD_PARENTDEF];
}
} | javascript | function (args) {
if (typeof(args.value) != 'string') {
return __badTypeError(this, args); // this refers to the correct object (a base type)
}
var beanDef = args.beanDef;
while (!beanDef[jv._MD_BUILTIN]) {
var regexp = beanDef.$regExp;
if (regexp != null) {
if (!regexp.test(args.value)) {
return jv._logError(jv.REGEXP_FAILED, [args.value, args.path, regexp, beanDef[jv._MD_TYPENAME]]);
}
}
beanDef = beanDef[jv._MD_PARENTDEF];
}
} | [
"function",
"(",
"args",
")",
"{",
"if",
"(",
"typeof",
"(",
"args",
".",
"value",
")",
"!=",
"'string'",
")",
"{",
"return",
"__badTypeError",
"(",
"this",
",",
"args",
")",
";",
"}",
"var",
"beanDef",
"=",
"args",
".",
"beanDef",
";",
"while",
"(",
"!",
"beanDef",
"[",
"jv",
".",
"_MD_BUILTIN",
"]",
")",
"{",
"var",
"regexp",
"=",
"beanDef",
".",
"$regExp",
";",
"if",
"(",
"regexp",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"regexp",
".",
"test",
"(",
"args",
".",
"value",
")",
")",
"{",
"return",
"jv",
".",
"_logError",
"(",
"jv",
".",
"REGEXP_FAILED",
",",
"[",
"args",
".",
"value",
",",
"args",
".",
"path",
",",
"regexp",
",",
"beanDef",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
"]",
")",
";",
"}",
"}",
"beanDef",
"=",
"beanDef",
"[",
"jv",
".",
"_MD_PARENTDEF",
"]",
";",
"}",
"}"
]
| Processing function for regular expressions
@private | [
"Processing",
"function",
"for",
"regular",
"expressions"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonTypesCheck.js#L122-L136 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonTypesCheck.js | function (beanDef) {
var parent = beanDef[jv._MD_PARENTDEF];
if (typeof(parent.$minValue) != "undefined") {
if (typeof(beanDef.$minValue) == "undefined") {
beanDef.$minValue = parent.$minValue;
} else if (beanDef.$minValue < parent.$minValue) {
jv._logError(jv.NUMBER_INVALID_INHERITANCE, ["$minValue", beanDef[jv._MD_TYPENAME]]);
}
}
if (typeof(parent.$maxValue) != "undefined") {
if (typeof(beanDef.$maxValue) == "undefined") {
beanDef.$maxValue = parent.$maxValue;
} else if (beanDef.$maxValue > parent.$maxValue) {
jv._logError(jv.NUMBER_INVALID_INHERITANCE, ["$maxValue", beanDef[jv._MD_TYPENAME]]);
}
}
if (typeof(beanDef.$minValue) != "undefined" && typeof(beanDef.$maxValue) != "undefined"
&& beanDef.$minValue > beanDef.$maxValue) {
jv._logError(jv.NUMBER_INVALID_RANGE, [beanDef[jv._MD_TYPENAME], beanDef.$minValue, beanDef.$maxValue]);
}
} | javascript | function (beanDef) {
var parent = beanDef[jv._MD_PARENTDEF];
if (typeof(parent.$minValue) != "undefined") {
if (typeof(beanDef.$minValue) == "undefined") {
beanDef.$minValue = parent.$minValue;
} else if (beanDef.$minValue < parent.$minValue) {
jv._logError(jv.NUMBER_INVALID_INHERITANCE, ["$minValue", beanDef[jv._MD_TYPENAME]]);
}
}
if (typeof(parent.$maxValue) != "undefined") {
if (typeof(beanDef.$maxValue) == "undefined") {
beanDef.$maxValue = parent.$maxValue;
} else if (beanDef.$maxValue > parent.$maxValue) {
jv._logError(jv.NUMBER_INVALID_INHERITANCE, ["$maxValue", beanDef[jv._MD_TYPENAME]]);
}
}
if (typeof(beanDef.$minValue) != "undefined" && typeof(beanDef.$maxValue) != "undefined"
&& beanDef.$minValue > beanDef.$maxValue) {
jv._logError(jv.NUMBER_INVALID_RANGE, [beanDef[jv._MD_TYPENAME], beanDef.$minValue, beanDef.$maxValue]);
}
} | [
"function",
"(",
"beanDef",
")",
"{",
"var",
"parent",
"=",
"beanDef",
"[",
"jv",
".",
"_MD_PARENTDEF",
"]",
";",
"if",
"(",
"typeof",
"(",
"parent",
".",
"$minValue",
")",
"!=",
"\"undefined\"",
")",
"{",
"if",
"(",
"typeof",
"(",
"beanDef",
".",
"$minValue",
")",
"==",
"\"undefined\"",
")",
"{",
"beanDef",
".",
"$minValue",
"=",
"parent",
".",
"$minValue",
";",
"}",
"else",
"if",
"(",
"beanDef",
".",
"$minValue",
"<",
"parent",
".",
"$minValue",
")",
"{",
"jv",
".",
"_logError",
"(",
"jv",
".",
"NUMBER_INVALID_INHERITANCE",
",",
"[",
"\"$minValue\"",
",",
"beanDef",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
"]",
")",
";",
"}",
"}",
"if",
"(",
"typeof",
"(",
"parent",
".",
"$maxValue",
")",
"!=",
"\"undefined\"",
")",
"{",
"if",
"(",
"typeof",
"(",
"beanDef",
".",
"$maxValue",
")",
"==",
"\"undefined\"",
")",
"{",
"beanDef",
".",
"$maxValue",
"=",
"parent",
".",
"$maxValue",
";",
"}",
"else",
"if",
"(",
"beanDef",
".",
"$maxValue",
">",
"parent",
".",
"$maxValue",
")",
"{",
"jv",
".",
"_logError",
"(",
"jv",
".",
"NUMBER_INVALID_INHERITANCE",
",",
"[",
"\"$maxValue\"",
",",
"beanDef",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
"]",
")",
";",
"}",
"}",
"if",
"(",
"typeof",
"(",
"beanDef",
".",
"$minValue",
")",
"!=",
"\"undefined\"",
"&&",
"typeof",
"(",
"beanDef",
".",
"$maxValue",
")",
"!=",
"\"undefined\"",
"&&",
"beanDef",
".",
"$minValue",
">",
"beanDef",
".",
"$maxValue",
")",
"{",
"jv",
".",
"_logError",
"(",
"jv",
".",
"NUMBER_INVALID_RANGE",
",",
"[",
"beanDef",
"[",
"jv",
".",
"_MD_TYPENAME",
"]",
",",
"beanDef",
".",
"$minValue",
",",
"beanDef",
".",
"$maxValue",
"]",
")",
";",
"}",
"}"
]
| Common preprocessing function for floats and integers.
@private
@param {aria.core.BaseTypes:Bean} beanDef | [
"Common",
"preprocessing",
"function",
"for",
"floats",
"and",
"integers",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonTypesCheck.js#L143-L163 | train |
|
ariatemplates/ariatemplates | src/aria/core/JsonTypesCheck.js | function (args) {
var v = args.value;
var beanDef = args.beanDef;
if (typeof(v) != 'number') {
return __badTypeError(this, args);
}
if (typeof(beanDef.$minValue) != "undefined" && v < beanDef.$minValue) {
return jv._logError(jv.NUMBER_RANGE, [args.value, args.path, "$minValue", beanDef.$minValue]);
}
if (typeof(beanDef.$maxValue) != "undefined" && v > beanDef.$maxValue) {
return jv._logError(jv.NUMBER_RANGE, [args.value, args.path, "$maxValue", beanDef.$maxValue]);
}
} | javascript | function (args) {
var v = args.value;
var beanDef = args.beanDef;
if (typeof(v) != 'number') {
return __badTypeError(this, args);
}
if (typeof(beanDef.$minValue) != "undefined" && v < beanDef.$minValue) {
return jv._logError(jv.NUMBER_RANGE, [args.value, args.path, "$minValue", beanDef.$minValue]);
}
if (typeof(beanDef.$maxValue) != "undefined" && v > beanDef.$maxValue) {
return jv._logError(jv.NUMBER_RANGE, [args.value, args.path, "$maxValue", beanDef.$maxValue]);
}
} | [
"function",
"(",
"args",
")",
"{",
"var",
"v",
"=",
"args",
".",
"value",
";",
"var",
"beanDef",
"=",
"args",
".",
"beanDef",
";",
"if",
"(",
"typeof",
"(",
"v",
")",
"!=",
"'number'",
")",
"{",
"return",
"__badTypeError",
"(",
"this",
",",
"args",
")",
";",
"}",
"if",
"(",
"typeof",
"(",
"beanDef",
".",
"$minValue",
")",
"!=",
"\"undefined\"",
"&&",
"v",
"<",
"beanDef",
".",
"$minValue",
")",
"{",
"return",
"jv",
".",
"_logError",
"(",
"jv",
".",
"NUMBER_RANGE",
",",
"[",
"args",
".",
"value",
",",
"args",
".",
"path",
",",
"\"$minValue\"",
",",
"beanDef",
".",
"$minValue",
"]",
")",
";",
"}",
"if",
"(",
"typeof",
"(",
"beanDef",
".",
"$maxValue",
")",
"!=",
"\"undefined\"",
"&&",
"v",
">",
"beanDef",
".",
"$maxValue",
")",
"{",
"return",
"jv",
".",
"_logError",
"(",
"jv",
".",
"NUMBER_RANGE",
",",
"[",
"args",
".",
"value",
",",
"args",
".",
"path",
",",
"\"$maxValue\"",
",",
"beanDef",
".",
"$maxValue",
"]",
")",
";",
"}",
"}"
]
| Common processing function for floats and integers.
@private
@param {Object} args | [
"Common",
"processing",
"function",
"for",
"floats",
"and",
"integers",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/JsonTypesCheck.js#L170-L182 | train |
|
ariatemplates/ariatemplates | src/aria/tools/ToolsModule.js | function (args, cb) {
this.bridge = args.bridge;
// add bridge to submodules init parameters
for (var i = 0, l = this.subModulesList.length; i < l; i++) {
if (!this.subModulesList[i].initArgs) {
this.subModulesList[i].initArgs = {};
this.subModulesList[i].initArgs.bridge = this.bridge;
}
}
// load subnodules
this.loadSubModules(this.subModulesList, {
fn : this.onSubModulesReady,
scope : this
});
this.$ModuleCtrl.init.call(this, args, cb);
} | javascript | function (args, cb) {
this.bridge = args.bridge;
// add bridge to submodules init parameters
for (var i = 0, l = this.subModulesList.length; i < l; i++) {
if (!this.subModulesList[i].initArgs) {
this.subModulesList[i].initArgs = {};
this.subModulesList[i].initArgs.bridge = this.bridge;
}
}
// load subnodules
this.loadSubModules(this.subModulesList, {
fn : this.onSubModulesReady,
scope : this
});
this.$ModuleCtrl.init.call(this, args, cb);
} | [
"function",
"(",
"args",
",",
"cb",
")",
"{",
"this",
".",
"bridge",
"=",
"args",
".",
"bridge",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"subModulesList",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"this",
".",
"subModulesList",
"[",
"i",
"]",
".",
"initArgs",
")",
"{",
"this",
".",
"subModulesList",
"[",
"i",
"]",
".",
"initArgs",
"=",
"{",
"}",
";",
"this",
".",
"subModulesList",
"[",
"i",
"]",
".",
"initArgs",
".",
"bridge",
"=",
"this",
".",
"bridge",
";",
"}",
"}",
"this",
".",
"loadSubModules",
"(",
"this",
".",
"subModulesList",
",",
"{",
"fn",
":",
"this",
".",
"onSubModulesReady",
",",
"scope",
":",
"this",
"}",
")",
";",
"this",
".",
"$ModuleCtrl",
".",
"init",
".",
"call",
"(",
"this",
",",
"args",
",",
"cb",
")",
";",
"}"
]
| Module initialization method
@param {Object} initArgs init argument expected to contain a single property "bridge" giving a reference to
the main window Bridge object.
@param {aria.core.CfgBeans:Callback} cb callback called when the initialization is finished | [
"Module",
"initialization",
"method"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/tools/ToolsModule.js#L63-L81 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiSelectController.js | function (options, textFieldValue) {
var selectedOptions = [];
var trim = ariaUtilsString.trim;
var inSplit = textFieldValue.split(this._separator);
if (inSplit) {
for (var i = 0, inSplitLen = aria.utils.Math.min(inSplit.length, this._maxOptions); i < inSplitLen; i++) {
for (var j = 0, optionsLen = options.length; j < optionsLen; j++) {
var key = trim(inSplit[i]);
options[j].label = options[j].label + "";
options[j].value = options[j].value + "";
key = key + "";
if ((trim(options[j].label.toLowerCase()) == key.toLowerCase() || trim(options[j].value.toLowerCase()) == key.toLowerCase())
&& !ariaUtilsArray.contains(selectedOptions, options[j].value)
&& !options[j].disabled) {
selectedOptions.push(options[j].value);
}
}
}
}
return selectedOptions;
} | javascript | function (options, textFieldValue) {
var selectedOptions = [];
var trim = ariaUtilsString.trim;
var inSplit = textFieldValue.split(this._separator);
if (inSplit) {
for (var i = 0, inSplitLen = aria.utils.Math.min(inSplit.length, this._maxOptions); i < inSplitLen; i++) {
for (var j = 0, optionsLen = options.length; j < optionsLen; j++) {
var key = trim(inSplit[i]);
options[j].label = options[j].label + "";
options[j].value = options[j].value + "";
key = key + "";
if ((trim(options[j].label.toLowerCase()) == key.toLowerCase() || trim(options[j].value.toLowerCase()) == key.toLowerCase())
&& !ariaUtilsArray.contains(selectedOptions, options[j].value)
&& !options[j].disabled) {
selectedOptions.push(options[j].value);
}
}
}
}
return selectedOptions;
} | [
"function",
"(",
"options",
",",
"textFieldValue",
")",
"{",
"var",
"selectedOptions",
"=",
"[",
"]",
";",
"var",
"trim",
"=",
"ariaUtilsString",
".",
"trim",
";",
"var",
"inSplit",
"=",
"textFieldValue",
".",
"split",
"(",
"this",
".",
"_separator",
")",
";",
"if",
"(",
"inSplit",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"inSplitLen",
"=",
"aria",
".",
"utils",
".",
"Math",
".",
"min",
"(",
"inSplit",
".",
"length",
",",
"this",
".",
"_maxOptions",
")",
";",
"i",
"<",
"inSplitLen",
";",
"i",
"++",
")",
"{",
"for",
"(",
"var",
"j",
"=",
"0",
",",
"optionsLen",
"=",
"options",
".",
"length",
";",
"j",
"<",
"optionsLen",
";",
"j",
"++",
")",
"{",
"var",
"key",
"=",
"trim",
"(",
"inSplit",
"[",
"i",
"]",
")",
";",
"options",
"[",
"j",
"]",
".",
"label",
"=",
"options",
"[",
"j",
"]",
".",
"label",
"+",
"\"\"",
";",
"options",
"[",
"j",
"]",
".",
"value",
"=",
"options",
"[",
"j",
"]",
".",
"value",
"+",
"\"\"",
";",
"key",
"=",
"key",
"+",
"\"\"",
";",
"if",
"(",
"(",
"trim",
"(",
"options",
"[",
"j",
"]",
".",
"label",
".",
"toLowerCase",
"(",
")",
")",
"==",
"key",
".",
"toLowerCase",
"(",
")",
"||",
"trim",
"(",
"options",
"[",
"j",
"]",
".",
"value",
".",
"toLowerCase",
"(",
")",
")",
"==",
"key",
".",
"toLowerCase",
"(",
")",
")",
"&&",
"!",
"ariaUtilsArray",
".",
"contains",
"(",
"selectedOptions",
",",
"options",
"[",
"j",
"]",
".",
"value",
")",
"&&",
"!",
"options",
"[",
"j",
"]",
".",
"disabled",
")",
"{",
"selectedOptions",
".",
"push",
"(",
"options",
"[",
"j",
"]",
".",
"value",
")",
";",
"}",
"}",
"}",
"}",
"return",
"selectedOptions",
";",
"}"
]
| Parse value inserted in the datefield to deduce selected objects
@protected
@param {Array} options
@param {String} textFieldValue
@return {Array} | [
"Parse",
"value",
"inserted",
"in",
"the",
"datefield",
"to",
"deduce",
"selected",
"objects"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiSelectController.js#L175-L200 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiSelectController.js | function (selectedValues) {
var toDisplay = this._fieldDisplay, options = this._dataModel.listContent;
var backUp = (this._fieldDisplay == 'value') ? 'label' : 'value';
var display = [], option;
for (var i = 0, l = selectedValues.length; i < l; i++) {
option = selectedValues[i];
for (var j = 0, l2 = options.length; j < l2; j++) {
if (options[j].value == option) {
display.push(options[j][toDisplay] ? options[j][toDisplay] : options[j][backUp]);
}
}
}
return display.join(this._separator);
} | javascript | function (selectedValues) {
var toDisplay = this._fieldDisplay, options = this._dataModel.listContent;
var backUp = (this._fieldDisplay == 'value') ? 'label' : 'value';
var display = [], option;
for (var i = 0, l = selectedValues.length; i < l; i++) {
option = selectedValues[i];
for (var j = 0, l2 = options.length; j < l2; j++) {
if (options[j].value == option) {
display.push(options[j][toDisplay] ? options[j][toDisplay] : options[j][backUp]);
}
}
}
return display.join(this._separator);
} | [
"function",
"(",
"selectedValues",
")",
"{",
"var",
"toDisplay",
"=",
"this",
".",
"_fieldDisplay",
",",
"options",
"=",
"this",
".",
"_dataModel",
".",
"listContent",
";",
"var",
"backUp",
"=",
"(",
"this",
".",
"_fieldDisplay",
"==",
"'value'",
")",
"?",
"'label'",
":",
"'value'",
";",
"var",
"display",
"=",
"[",
"]",
",",
"option",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"selectedValues",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"option",
"=",
"selectedValues",
"[",
"i",
"]",
";",
"for",
"(",
"var",
"j",
"=",
"0",
",",
"l2",
"=",
"options",
".",
"length",
";",
"j",
"<",
"l2",
";",
"j",
"++",
")",
"{",
"if",
"(",
"options",
"[",
"j",
"]",
".",
"value",
"==",
"option",
")",
"{",
"display",
".",
"push",
"(",
"options",
"[",
"j",
"]",
"[",
"toDisplay",
"]",
"?",
"options",
"[",
"j",
"]",
"[",
"toDisplay",
"]",
":",
"options",
"[",
"j",
"]",
"[",
"backUp",
"]",
")",
";",
"}",
"}",
"}",
"return",
"display",
".",
"join",
"(",
"this",
".",
"_separator",
")",
";",
"}"
]
| Adds or remove items from the display value. If I am adding an item I also check that it wasn't already added
previously so there will be no duplicate items displayed.
@param {Array} selectedValues
@return {String} | [
"Adds",
"or",
"remove",
"items",
"from",
"the",
"display",
"value",
".",
"If",
"I",
"am",
"adding",
"an",
"item",
"I",
"also",
"check",
"that",
"it",
"wasn",
"t",
"already",
"added",
"previously",
"so",
"there",
"will",
"be",
"no",
"duplicate",
"items",
"displayed",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiSelectController.js#L208-L223 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiSelectController.js | function (value) {
var report = new ariaWidgetsControllersReportsDropDownControllerReport();
var dataModel = this._dataModel;
if (value === null) {
report.ok = true;
dataModel.value = null;
dataModel.text = '';
} else {
if (!ariaUtilsJson.equals(value, dataModel.value)) {
// Only update the data-model if there has been a change, otherwise onchange is raised
ariaUtilsJson.setValue(dataModel, 'selectedValues', value);
dataModel.value = value;
} else {
if (!ariaUtilsJson.equals(dataModel.selectedValues, dataModel.value)) {
// Only update the data-model if there has been a change, otherwise onchange is raised
value = dataModel.selectedValues;
dataModel.value = value;
}
}
report.ok = true;
var text = this._getDisplayValue(value);
dataModel.text = text;
}
if (report.ok) {
report.text = dataModel.text;
report.value = this._getValue(dataModel.text, dataModel.value);
}
return report;
} | javascript | function (value) {
var report = new ariaWidgetsControllersReportsDropDownControllerReport();
var dataModel = this._dataModel;
if (value === null) {
report.ok = true;
dataModel.value = null;
dataModel.text = '';
} else {
if (!ariaUtilsJson.equals(value, dataModel.value)) {
// Only update the data-model if there has been a change, otherwise onchange is raised
ariaUtilsJson.setValue(dataModel, 'selectedValues', value);
dataModel.value = value;
} else {
if (!ariaUtilsJson.equals(dataModel.selectedValues, dataModel.value)) {
// Only update the data-model if there has been a change, otherwise onchange is raised
value = dataModel.selectedValues;
dataModel.value = value;
}
}
report.ok = true;
var text = this._getDisplayValue(value);
dataModel.text = text;
}
if (report.ok) {
report.text = dataModel.text;
report.value = this._getValue(dataModel.text, dataModel.value);
}
return report;
} | [
"function",
"(",
"value",
")",
"{",
"var",
"report",
"=",
"new",
"ariaWidgetsControllersReportsDropDownControllerReport",
"(",
")",
";",
"var",
"dataModel",
"=",
"this",
".",
"_dataModel",
";",
"if",
"(",
"value",
"===",
"null",
")",
"{",
"report",
".",
"ok",
"=",
"true",
";",
"dataModel",
".",
"value",
"=",
"null",
";",
"dataModel",
".",
"text",
"=",
"''",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"ariaUtilsJson",
".",
"equals",
"(",
"value",
",",
"dataModel",
".",
"value",
")",
")",
"{",
"ariaUtilsJson",
".",
"setValue",
"(",
"dataModel",
",",
"'selectedValues'",
",",
"value",
")",
";",
"dataModel",
".",
"value",
"=",
"value",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"ariaUtilsJson",
".",
"equals",
"(",
"dataModel",
".",
"selectedValues",
",",
"dataModel",
".",
"value",
")",
")",
"{",
"value",
"=",
"dataModel",
".",
"selectedValues",
";",
"dataModel",
".",
"value",
"=",
"value",
";",
"}",
"}",
"report",
".",
"ok",
"=",
"true",
";",
"var",
"text",
"=",
"this",
".",
"_getDisplayValue",
"(",
"value",
")",
";",
"dataModel",
".",
"text",
"=",
"text",
";",
"}",
"if",
"(",
"report",
".",
"ok",
")",
"{",
"report",
".",
"text",
"=",
"dataModel",
".",
"text",
";",
"report",
".",
"value",
"=",
"this",
".",
"_getValue",
"(",
"dataModel",
".",
"text",
",",
"dataModel",
".",
"value",
")",
";",
"}",
"return",
"report",
";",
"}"
]
| override DropDownListController.checkValue
@param {String} value
@return {aria.widgets.controllers.reports.DropDownControllerReport} | [
"override",
"DropDownListController",
".",
"checkValue"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiSelectController.js#L230-L259 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiSelectController.js | function (str) {
var dataModel = this._dataModel, options = dataModel.listContent, selectedValues;
// retrieve selection from string
selectedValues = this._parseInputString(options, str);
if (!ariaUtilsJson.equals(selectedValues, dataModel.value)) {
ariaUtilsJson.setValue(dataModel, 'value', selectedValues);
ariaUtilsJson.setValue(dataModel, 'text', this._getDisplayValue(selectedValues));
ariaUtilsJson.setValue(dataModel, 'selectedValues', selectedValues);
}
var report = new ariaWidgetsControllersReportsDropDownControllerReport();
report.text = dataModel.text;
report.value = this._getValue(dataModel.text, dataModel.value);
return report;
} | javascript | function (str) {
var dataModel = this._dataModel, options = dataModel.listContent, selectedValues;
// retrieve selection from string
selectedValues = this._parseInputString(options, str);
if (!ariaUtilsJson.equals(selectedValues, dataModel.value)) {
ariaUtilsJson.setValue(dataModel, 'value', selectedValues);
ariaUtilsJson.setValue(dataModel, 'text', this._getDisplayValue(selectedValues));
ariaUtilsJson.setValue(dataModel, 'selectedValues', selectedValues);
}
var report = new ariaWidgetsControllersReportsDropDownControllerReport();
report.text = dataModel.text;
report.value = this._getValue(dataModel.text, dataModel.value);
return report;
} | [
"function",
"(",
"str",
")",
"{",
"var",
"dataModel",
"=",
"this",
".",
"_dataModel",
",",
"options",
"=",
"dataModel",
".",
"listContent",
",",
"selectedValues",
";",
"selectedValues",
"=",
"this",
".",
"_parseInputString",
"(",
"options",
",",
"str",
")",
";",
"if",
"(",
"!",
"ariaUtilsJson",
".",
"equals",
"(",
"selectedValues",
",",
"dataModel",
".",
"value",
")",
")",
"{",
"ariaUtilsJson",
".",
"setValue",
"(",
"dataModel",
",",
"'value'",
",",
"selectedValues",
")",
";",
"ariaUtilsJson",
".",
"setValue",
"(",
"dataModel",
",",
"'text'",
",",
"this",
".",
"_getDisplayValue",
"(",
"selectedValues",
")",
")",
";",
"ariaUtilsJson",
".",
"setValue",
"(",
"dataModel",
",",
"'selectedValues'",
",",
"selectedValues",
")",
";",
"}",
"var",
"report",
"=",
"new",
"ariaWidgetsControllersReportsDropDownControllerReport",
"(",
")",
";",
"report",
".",
"text",
"=",
"dataModel",
".",
"text",
";",
"report",
".",
"value",
"=",
"this",
".",
"_getValue",
"(",
"dataModel",
".",
"text",
",",
"dataModel",
".",
"value",
")",
";",
"return",
"report",
";",
"}"
]
| override DropDownController.checkText
@param {String} str
@return {aria.widgets.controllers.reports.DropDownControllerReport} | [
"override",
"DropDownController",
".",
"checkText"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiSelectController.js#L266-L286 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiSelectController.js | function () {
var options = this._dataModel.listContent, value;
for (var i = 0, len = options.length; i < len; i++) {
value = options[i].value + "";
if (value.indexOf(this._separator) != -1) {
this.$logError(this.INVALID_MULTISELECT_CONTENT);
break;
}
}
} | javascript | function () {
var options = this._dataModel.listContent, value;
for (var i = 0, len = options.length; i < len; i++) {
value = options[i].value + "";
if (value.indexOf(this._separator) != -1) {
this.$logError(this.INVALID_MULTISELECT_CONTENT);
break;
}
}
} | [
"function",
"(",
")",
"{",
"var",
"options",
"=",
"this",
".",
"_dataModel",
".",
"listContent",
",",
"value",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"options",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"value",
"=",
"options",
"[",
"i",
"]",
".",
"value",
"+",
"\"\"",
";",
"if",
"(",
"value",
".",
"indexOf",
"(",
"this",
".",
"_separator",
")",
"!=",
"-",
"1",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_MULTISELECT_CONTENT",
")",
";",
"break",
";",
"}",
"}",
"}"
]
| Log the Error when option value contains field separator logged message | [
"Log",
"the",
"Error",
"when",
"option",
"value",
"contains",
"field",
"separator",
"logged",
"message"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiSelectController.js#L291-L301 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/controllers/MultiSelectController.js | function (text, value) {
var cachedValue = this._cacheValues[text];
if (cachedValue) {
return cachedValue;
}
this._cacheValues[text] = value;
return value;
} | javascript | function (text, value) {
var cachedValue = this._cacheValues[text];
if (cachedValue) {
return cachedValue;
}
this._cacheValues[text] = value;
return value;
} | [
"function",
"(",
"text",
",",
"value",
")",
"{",
"var",
"cachedValue",
"=",
"this",
".",
"_cacheValues",
"[",
"text",
"]",
";",
"if",
"(",
"cachedValue",
")",
"{",
"return",
"cachedValue",
";",
"}",
"this",
".",
"_cacheValues",
"[",
"text",
"]",
"=",
"value",
";",
"return",
"value",
";",
"}"
]
| Return the value for given text in input and value
@protected
@param {String} text
@param {Object} value
@return {Object} | [
"Return",
"the",
"value",
"for",
"given",
"text",
"in",
"input",
"and",
"value"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/controllers/MultiSelectController.js#L333-L340 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function (firstStart) {
this._startTime = (firstStart) ? Aria._start : new Date();
if (firstStart) {
this._logs = [{
classpath : "Aria",
msg : "Framework initialization",
start : Aria._start
}, {
classpath : "Aria",
stop : (new Date()).getTime()
}];
this._nbLogs = 2;
} else {
this._logs = [];
this._nbLogs = 0;
}
// map function on JsObject prototype
ariaCoreJsObject.prototype.$logTimestamp = function (msg, classpath) {
classpath = classpath ? classpath : this.$classpath;
aria.utils.Profiling.logTimestamp(classpath, msg);
};
ariaCoreJsObject.prototype.$startMeasure = function (msg, classpath) {
classpath = classpath ? classpath : this.$classpath;
return aria.utils.Profiling.startMeasure(classpath, msg);
};
ariaCoreJsObject.prototype.$stopMeasure = function (id, classpath) {
classpath = classpath ? classpath : this.$classpath;
aria.utils.Profiling.stopMeasure(classpath, id);
};
} | javascript | function (firstStart) {
this._startTime = (firstStart) ? Aria._start : new Date();
if (firstStart) {
this._logs = [{
classpath : "Aria",
msg : "Framework initialization",
start : Aria._start
}, {
classpath : "Aria",
stop : (new Date()).getTime()
}];
this._nbLogs = 2;
} else {
this._logs = [];
this._nbLogs = 0;
}
// map function on JsObject prototype
ariaCoreJsObject.prototype.$logTimestamp = function (msg, classpath) {
classpath = classpath ? classpath : this.$classpath;
aria.utils.Profiling.logTimestamp(classpath, msg);
};
ariaCoreJsObject.prototype.$startMeasure = function (msg, classpath) {
classpath = classpath ? classpath : this.$classpath;
return aria.utils.Profiling.startMeasure(classpath, msg);
};
ariaCoreJsObject.prototype.$stopMeasure = function (id, classpath) {
classpath = classpath ? classpath : this.$classpath;
aria.utils.Profiling.stopMeasure(classpath, id);
};
} | [
"function",
"(",
"firstStart",
")",
"{",
"this",
".",
"_startTime",
"=",
"(",
"firstStart",
")",
"?",
"Aria",
".",
"_start",
":",
"new",
"Date",
"(",
")",
";",
"if",
"(",
"firstStart",
")",
"{",
"this",
".",
"_logs",
"=",
"[",
"{",
"classpath",
":",
"\"Aria\"",
",",
"msg",
":",
"\"Framework initialization\"",
",",
"start",
":",
"Aria",
".",
"_start",
"}",
",",
"{",
"classpath",
":",
"\"Aria\"",
",",
"stop",
":",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
"}",
"]",
";",
"this",
".",
"_nbLogs",
"=",
"2",
";",
"}",
"else",
"{",
"this",
".",
"_logs",
"=",
"[",
"]",
";",
"this",
".",
"_nbLogs",
"=",
"0",
";",
"}",
"ariaCoreJsObject",
".",
"prototype",
".",
"$logTimestamp",
"=",
"function",
"(",
"msg",
",",
"classpath",
")",
"{",
"classpath",
"=",
"classpath",
"?",
"classpath",
":",
"this",
".",
"$classpath",
";",
"aria",
".",
"utils",
".",
"Profiling",
".",
"logTimestamp",
"(",
"classpath",
",",
"msg",
")",
";",
"}",
";",
"ariaCoreJsObject",
".",
"prototype",
".",
"$startMeasure",
"=",
"function",
"(",
"msg",
",",
"classpath",
")",
"{",
"classpath",
"=",
"classpath",
"?",
"classpath",
":",
"this",
".",
"$classpath",
";",
"return",
"aria",
".",
"utils",
".",
"Profiling",
".",
"startMeasure",
"(",
"classpath",
",",
"msg",
")",
";",
"}",
";",
"ariaCoreJsObject",
".",
"prototype",
".",
"$stopMeasure",
"=",
"function",
"(",
"id",
",",
"classpath",
")",
"{",
"classpath",
"=",
"classpath",
"?",
"classpath",
":",
"this",
".",
"$classpath",
";",
"aria",
".",
"utils",
".",
"Profiling",
".",
"stopMeasure",
"(",
"classpath",
",",
"id",
")",
";",
"}",
";",
"}"
]
| Reinitialize the profiling
@param {Boolean} firstStart | [
"Reinitialize",
"the",
"profiling"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L100-L130 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function () {
this._logsPerClasspath = {};
var i, j, iLog, jLog, max, end;
max = 0;
for (i = 0; i < this._nbLogs; i++) {
iLog = this._logs[i];
if (iLog.start && !("length" in iLog)) {
for (j = i + 1; j < this._nbLogs; j++) {
jLog = this._logs[j];
if (jLog.stop && jLog.classpath == iLog.classpath) {
if (!jLog.id || iLog.id === jLog.id) {
this._logs.splice(j, 1);
this._nbLogs--;
iLog.length = jLog.stop - iLog.start;
iLog.start = iLog.start - this._startTime;
break;
}
}
}
if (!("length" in iLog)) {
// no matching call to $stopMeasure
iLog.length = 0;
iLog.start = iLog.start - this._startTime;
}
} else if (iLog.timestamp) {
iLog.start = iLog.timestamp - this._startTime;
iLog.length = 0;
delete iLog.timestamp;
}
if (!("msg" in iLog)) {
iLog.msg = 'NO MESSAGE';
}
end = iLog.start + iLog.length;
if (end > max) {
max = end;
}
// add in processed logs object
if (!this._logsPerClasspath[iLog.classpath]) {
this._logsPerClasspath[iLog.classpath] = {};
}
var cpLog = this._logsPerClasspath[iLog.classpath];
if (!cpLog[iLog.msg]) {
cpLog[iLog.msg] = [0];
}
cpLog[iLog.msg].push(iLog);
cpLog[iLog.msg][0] += iLog.length;
}
this._logsPerClasspath._max = max;
} | javascript | function () {
this._logsPerClasspath = {};
var i, j, iLog, jLog, max, end;
max = 0;
for (i = 0; i < this._nbLogs; i++) {
iLog = this._logs[i];
if (iLog.start && !("length" in iLog)) {
for (j = i + 1; j < this._nbLogs; j++) {
jLog = this._logs[j];
if (jLog.stop && jLog.classpath == iLog.classpath) {
if (!jLog.id || iLog.id === jLog.id) {
this._logs.splice(j, 1);
this._nbLogs--;
iLog.length = jLog.stop - iLog.start;
iLog.start = iLog.start - this._startTime;
break;
}
}
}
if (!("length" in iLog)) {
// no matching call to $stopMeasure
iLog.length = 0;
iLog.start = iLog.start - this._startTime;
}
} else if (iLog.timestamp) {
iLog.start = iLog.timestamp - this._startTime;
iLog.length = 0;
delete iLog.timestamp;
}
if (!("msg" in iLog)) {
iLog.msg = 'NO MESSAGE';
}
end = iLog.start + iLog.length;
if (end > max) {
max = end;
}
// add in processed logs object
if (!this._logsPerClasspath[iLog.classpath]) {
this._logsPerClasspath[iLog.classpath] = {};
}
var cpLog = this._logsPerClasspath[iLog.classpath];
if (!cpLog[iLog.msg]) {
cpLog[iLog.msg] = [0];
}
cpLog[iLog.msg].push(iLog);
cpLog[iLog.msg][0] += iLog.length;
}
this._logsPerClasspath._max = max;
} | [
"function",
"(",
")",
"{",
"this",
".",
"_logsPerClasspath",
"=",
"{",
"}",
";",
"var",
"i",
",",
"j",
",",
"iLog",
",",
"jLog",
",",
"max",
",",
"end",
";",
"max",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_nbLogs",
";",
"i",
"++",
")",
"{",
"iLog",
"=",
"this",
".",
"_logs",
"[",
"i",
"]",
";",
"if",
"(",
"iLog",
".",
"start",
"&&",
"!",
"(",
"\"length\"",
"in",
"iLog",
")",
")",
"{",
"for",
"(",
"j",
"=",
"i",
"+",
"1",
";",
"j",
"<",
"this",
".",
"_nbLogs",
";",
"j",
"++",
")",
"{",
"jLog",
"=",
"this",
".",
"_logs",
"[",
"j",
"]",
";",
"if",
"(",
"jLog",
".",
"stop",
"&&",
"jLog",
".",
"classpath",
"==",
"iLog",
".",
"classpath",
")",
"{",
"if",
"(",
"!",
"jLog",
".",
"id",
"||",
"iLog",
".",
"id",
"===",
"jLog",
".",
"id",
")",
"{",
"this",
".",
"_logs",
".",
"splice",
"(",
"j",
",",
"1",
")",
";",
"this",
".",
"_nbLogs",
"--",
";",
"iLog",
".",
"length",
"=",
"jLog",
".",
"stop",
"-",
"iLog",
".",
"start",
";",
"iLog",
".",
"start",
"=",
"iLog",
".",
"start",
"-",
"this",
".",
"_startTime",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"(",
"\"length\"",
"in",
"iLog",
")",
")",
"{",
"iLog",
".",
"length",
"=",
"0",
";",
"iLog",
".",
"start",
"=",
"iLog",
".",
"start",
"-",
"this",
".",
"_startTime",
";",
"}",
"}",
"else",
"if",
"(",
"iLog",
".",
"timestamp",
")",
"{",
"iLog",
".",
"start",
"=",
"iLog",
".",
"timestamp",
"-",
"this",
".",
"_startTime",
";",
"iLog",
".",
"length",
"=",
"0",
";",
"delete",
"iLog",
".",
"timestamp",
";",
"}",
"if",
"(",
"!",
"(",
"\"msg\"",
"in",
"iLog",
")",
")",
"{",
"iLog",
".",
"msg",
"=",
"'NO MESSAGE'",
";",
"}",
"end",
"=",
"iLog",
".",
"start",
"+",
"iLog",
".",
"length",
";",
"if",
"(",
"end",
">",
"max",
")",
"{",
"max",
"=",
"end",
";",
"}",
"if",
"(",
"!",
"this",
".",
"_logsPerClasspath",
"[",
"iLog",
".",
"classpath",
"]",
")",
"{",
"this",
".",
"_logsPerClasspath",
"[",
"iLog",
".",
"classpath",
"]",
"=",
"{",
"}",
";",
"}",
"var",
"cpLog",
"=",
"this",
".",
"_logsPerClasspath",
"[",
"iLog",
".",
"classpath",
"]",
";",
"if",
"(",
"!",
"cpLog",
"[",
"iLog",
".",
"msg",
"]",
")",
"{",
"cpLog",
"[",
"iLog",
".",
"msg",
"]",
"=",
"[",
"0",
"]",
";",
"}",
"cpLog",
"[",
"iLog",
".",
"msg",
"]",
".",
"push",
"(",
"iLog",
")",
";",
"cpLog",
"[",
"iLog",
".",
"msg",
"]",
"[",
"0",
"]",
"+=",
"iLog",
".",
"length",
";",
"}",
"this",
".",
"_logsPerClasspath",
".",
"_max",
"=",
"max",
";",
"}"
]
| Process measures to associate starts and stops, sort by classpath | [
"Process",
"measures",
"to",
"associate",
"starts",
"and",
"stops",
"sort",
"by",
"classpath"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L135-L186 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function (div) {
if (this._displayDiv != null) {
return;
}
this.process();
var document = Aria.$window.document;
this._displayDiv = document.createElement('div');
this._displayDiv.style.cssText = "position:absolute;top:0px;left:0px;width:100%;height:100%; z-index:99999999;overflow:auto;background:white";
document.body.appendChild(this._displayDiv);
Aria.loadTemplate({
classpath : 'aria.utils.ProfilingDisplay',
div : this._displayDiv,
data : ariaUtilsJson.copy(this._logsPerClasspath, true)
});
} | javascript | function (div) {
if (this._displayDiv != null) {
return;
}
this.process();
var document = Aria.$window.document;
this._displayDiv = document.createElement('div');
this._displayDiv.style.cssText = "position:absolute;top:0px;left:0px;width:100%;height:100%; z-index:99999999;overflow:auto;background:white";
document.body.appendChild(this._displayDiv);
Aria.loadTemplate({
classpath : 'aria.utils.ProfilingDisplay',
div : this._displayDiv,
data : ariaUtilsJson.copy(this._logsPerClasspath, true)
});
} | [
"function",
"(",
"div",
")",
"{",
"if",
"(",
"this",
".",
"_displayDiv",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"this",
".",
"process",
"(",
")",
";",
"var",
"document",
"=",
"Aria",
".",
"$window",
".",
"document",
";",
"this",
".",
"_displayDiv",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"this",
".",
"_displayDiv",
".",
"style",
".",
"cssText",
"=",
"\"position:absolute;top:0px;left:0px;width:100%;height:100%; z-index:99999999;overflow:auto;background:white\"",
";",
"document",
".",
"body",
".",
"appendChild",
"(",
"this",
".",
"_displayDiv",
")",
";",
"Aria",
".",
"loadTemplate",
"(",
"{",
"classpath",
":",
"'aria.utils.ProfilingDisplay'",
",",
"div",
":",
"this",
".",
"_displayDiv",
",",
"data",
":",
"ariaUtilsJson",
".",
"copy",
"(",
"this",
".",
"_logsPerClasspath",
",",
"true",
")",
"}",
")",
";",
"}"
]
| Show an alert containing profiling data and then clears corresponding data.
@param {HTMLElement} div | [
"Show",
"an",
"alert",
"containing",
"profiling",
"data",
"and",
"then",
"clears",
"corresponding",
"data",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L192-L211 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function () {
this._displayDiv.innerHTML = '';
if (this._displayDiv != null) {
aria.utils.Dom.removeElement(this._displayDiv);
}
this._displayDiv = null;
} | javascript | function () {
this._displayDiv.innerHTML = '';
if (this._displayDiv != null) {
aria.utils.Dom.removeElement(this._displayDiv);
}
this._displayDiv = null;
} | [
"function",
"(",
")",
"{",
"this",
".",
"_displayDiv",
".",
"innerHTML",
"=",
"''",
";",
"if",
"(",
"this",
".",
"_displayDiv",
"!=",
"null",
")",
"{",
"aria",
".",
"utils",
".",
"Dom",
".",
"removeElement",
"(",
"this",
".",
"_displayDiv",
")",
";",
"}",
"this",
".",
"_displayDiv",
"=",
"null",
";",
"}"
]
| Hide profiling display | [
"Hide",
"profiling",
"display"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L216-L222 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function (classpath, msg) {
this._logs[this._nbLogs++] = {
classpath : classpath,
msg : msg,
timestamp : (new Date()).getTime()
};
} | javascript | function (classpath, msg) {
this._logs[this._nbLogs++] = {
classpath : classpath,
msg : msg,
timestamp : (new Date()).getTime()
};
} | [
"function",
"(",
"classpath",
",",
"msg",
")",
"{",
"this",
".",
"_logs",
"[",
"this",
".",
"_nbLogs",
"++",
"]",
"=",
"{",
"classpath",
":",
"classpath",
",",
"msg",
":",
"msg",
",",
"timestamp",
":",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
"}",
";",
"}"
]
| Log a message with a time stamp
@param {String} classpath
@param {String} msg | [
"Log",
"a",
"message",
"with",
"a",
"time",
"stamp"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L229-L235 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function (classpath, msg) {
this._logs[this._nbLogs++] = {
classpath : classpath,
msg : msg,
id : this._ids,
start : (new Date()).getTime()
};
return this._ids++;
} | javascript | function (classpath, msg) {
this._logs[this._nbLogs++] = {
classpath : classpath,
msg : msg,
id : this._ids,
start : (new Date()).getTime()
};
return this._ids++;
} | [
"function",
"(",
"classpath",
",",
"msg",
")",
"{",
"this",
".",
"_logs",
"[",
"this",
".",
"_nbLogs",
"++",
"]",
"=",
"{",
"classpath",
":",
"classpath",
",",
"msg",
":",
"msg",
",",
"id",
":",
"this",
".",
"_ids",
",",
"start",
":",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
"}",
";",
"return",
"this",
".",
"_ids",
"++",
";",
"}"
]
| Starts a time measure. Returns the id used to stop the measure.
@param {String} classpath
@param {String} msg
@return {Number} profilingId | [
"Starts",
"a",
"time",
"measure",
".",
"Returns",
"the",
"id",
"used",
"to",
"stop",
"the",
"measure",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L243-L251 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function (classpath, id) {
this._logs[this._nbLogs++] = {
classpath : classpath,
id : id,
stop : (new Date()).getTime()
};
} | javascript | function (classpath, id) {
this._logs[this._nbLogs++] = {
classpath : classpath,
id : id,
stop : (new Date()).getTime()
};
} | [
"function",
"(",
"classpath",
",",
"id",
")",
"{",
"this",
".",
"_logs",
"[",
"this",
".",
"_nbLogs",
"++",
"]",
"=",
"{",
"classpath",
":",
"classpath",
",",
"id",
":",
"id",
",",
"stop",
":",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
"}",
";",
"}"
]
| Stops a time measure. If the id is not specified, stop the last measure with this classpath.
@param {String} classpath
@param {String} id | [
"Stops",
"a",
"time",
"measure",
".",
"If",
"the",
"id",
"is",
"not",
"specified",
"stop",
"the",
"last",
"measure",
"with",
"this",
"classpath",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L258-L264 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function (name, step) {
if (this._counters.hasOwnProperty(name)) {
this._counters[name] += (step || 1);
} else {
this._counters[name] = (step || 1);
}
} | javascript | function (name, step) {
if (this._counters.hasOwnProperty(name)) {
this._counters[name] += (step || 1);
} else {
this._counters[name] = (step || 1);
}
} | [
"function",
"(",
"name",
",",
"step",
")",
"{",
"if",
"(",
"this",
".",
"_counters",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"this",
".",
"_counters",
"[",
"name",
"]",
"+=",
"(",
"step",
"||",
"1",
")",
";",
"}",
"else",
"{",
"this",
".",
"_counters",
"[",
"name",
"]",
"=",
"(",
"step",
"||",
"1",
")",
";",
"}",
"}"
]
| Increment a counter with a given name by an arbitrary value.
@param {String} name Name of the counter
@param {Number} step Value to be added, Default 1 | [
"Increment",
"a",
"counter",
"with",
"a",
"given",
"name",
"by",
"an",
"arbitrary",
"value",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L271-L277 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function (name, reason) {
if (!this._counters[name]) {
return;
}
if (!this._counterSplits[name]) {
this._counterSplits[name] = [];
}
this._counterSplits[name].push({
value : this._counters[name],
reason : reason
});
this._counters[name] = 0;
} | javascript | function (name, reason) {
if (!this._counters[name]) {
return;
}
if (!this._counterSplits[name]) {
this._counterSplits[name] = [];
}
this._counterSplits[name].push({
value : this._counters[name],
reason : reason
});
this._counters[name] = 0;
} | [
"function",
"(",
"name",
",",
"reason",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_counters",
"[",
"name",
"]",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"this",
".",
"_counterSplits",
"[",
"name",
"]",
")",
"{",
"this",
".",
"_counterSplits",
"[",
"name",
"]",
"=",
"[",
"]",
";",
"}",
"this",
".",
"_counterSplits",
"[",
"name",
"]",
".",
"push",
"(",
"{",
"value",
":",
"this",
".",
"_counters",
"[",
"name",
"]",
",",
"reason",
":",
"reason",
"}",
")",
";",
"this",
".",
"_counters",
"[",
"name",
"]",
"=",
"0",
";",
"}"
]
| Reset a counter with a given name to 0. The last value is saved as a split.
@param {String} name Name of the counter
@param {String} reason Additional information on the split, it is useful for computing averages | [
"Reset",
"a",
"counter",
"with",
"a",
"given",
"name",
"to",
"0",
".",
"The",
"last",
"value",
"is",
"saved",
"as",
"a",
"split",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L284-L299 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Profiling.js | function (name, reason) {
if (!this._counterSplits[name]) {
return 0;
}
var total = 0;
for (var i = 0, len = this._counterSplits[name].length; i < len; i += 1) {
total += this._counterSplits[name][i].value;
}
return total / len;
} | javascript | function (name, reason) {
if (!this._counterSplits[name]) {
return 0;
}
var total = 0;
for (var i = 0, len = this._counterSplits[name].length; i < len; i += 1) {
total += this._counterSplits[name][i].value;
}
return total / len;
} | [
"function",
"(",
"name",
",",
"reason",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_counterSplits",
"[",
"name",
"]",
")",
"{",
"return",
"0",
";",
"}",
"var",
"total",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"this",
".",
"_counterSplits",
"[",
"name",
"]",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"+=",
"1",
")",
"{",
"total",
"+=",
"this",
".",
"_counterSplits",
"[",
"name",
"]",
"[",
"i",
"]",
".",
"value",
";",
"}",
"return",
"total",
"/",
"len",
";",
"}"
]
| Get the average value of the splits on a given counter. The current value of the counter is not taken into
account. If needed call a resetCounter before this method
@param {String} name Name of the counter
@param {String} reason Filter only the splits with this reason value
@return {Number} | [
"Get",
"the",
"average",
"value",
"of",
"the",
"splits",
"on",
"a",
"given",
"counter",
".",
"The",
"current",
"value",
"of",
"the",
"counter",
"is",
"not",
"taken",
"into",
"account",
".",
"If",
"needed",
"call",
"a",
"resetCounter",
"before",
"this",
"method"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Profiling.js#L317-L328 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Xml.js | function (str) {
var xmlDoc;
var DOMParser = Aria.$global.DOMParser;
if (DOMParser) {
var parser = new DOMParser();
xmlDoc = parser.parseFromString(str, "text/xml");
} else { // Internet Explorer
var ActiveXObject = Aria.$global.ActiveXObject;
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(str);
}
if (xmlDoc.hasChildNodes()) {
return this.__parseXmlNode(xmlDoc);
} else {
return null;
}
} | javascript | function (str) {
var xmlDoc;
var DOMParser = Aria.$global.DOMParser;
if (DOMParser) {
var parser = new DOMParser();
xmlDoc = parser.parseFromString(str, "text/xml");
} else { // Internet Explorer
var ActiveXObject = Aria.$global.ActiveXObject;
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(str);
}
if (xmlDoc.hasChildNodes()) {
return this.__parseXmlNode(xmlDoc);
} else {
return null;
}
} | [
"function",
"(",
"str",
")",
"{",
"var",
"xmlDoc",
";",
"var",
"DOMParser",
"=",
"Aria",
".",
"$global",
".",
"DOMParser",
";",
"if",
"(",
"DOMParser",
")",
"{",
"var",
"parser",
"=",
"new",
"DOMParser",
"(",
")",
";",
"xmlDoc",
"=",
"parser",
".",
"parseFromString",
"(",
"str",
",",
"\"text/xml\"",
")",
";",
"}",
"else",
"{",
"var",
"ActiveXObject",
"=",
"Aria",
".",
"$global",
".",
"ActiveXObject",
";",
"xmlDoc",
"=",
"new",
"ActiveXObject",
"(",
"\"Microsoft.XMLDOM\"",
")",
";",
"xmlDoc",
".",
"async",
"=",
"\"false\"",
";",
"xmlDoc",
".",
"loadXML",
"(",
"str",
")",
";",
"}",
"if",
"(",
"xmlDoc",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"return",
"this",
".",
"__parseXmlNode",
"(",
"xmlDoc",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
]
| Performs a lossy conversion of a Xml string to a Json object Node atrributes are omitted in the parsing
process
@param {String} str The content of the Xml document
@return {Object} Json represantation of the Xml content | [
"Performs",
"a",
"lossy",
"conversion",
"of",
"a",
"Xml",
"string",
"to",
"a",
"Json",
"object",
"Node",
"atrributes",
"are",
"omitted",
"in",
"the",
"parsing",
"process"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Xml.js#L34-L52 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Xml.js | function (xmlNode) {
if (!xmlNode) {
return;
}
var node = {};
for (var i = 0; i < xmlNode.childNodes.length; i++) {
var currNode = xmlNode.childNodes[i];
// if it's a text node or a CDATA section use the nodeValue directly
if (currNode.nodeType != 3 && currNode.nodeType != 4) {
var name = currNode.nodeName;
var count = 0;
for (var j = 0; j < xmlNode.childNodes.length; j++) {
if (xmlNode.childNodes[j].nodeName == name) {
if (++count == 2) {
break;
}
}
}
var el = this.__parseXmlNode(currNode);
if (count == 2) {
if (node[name] == null) {
node[name] = [];
}
node[name].push(el);
} else {
node[name] = el;
}
} else if (xmlNode.childNodes.length == 1) {
node = currNode.nodeValue;
}
}
return node;
} | javascript | function (xmlNode) {
if (!xmlNode) {
return;
}
var node = {};
for (var i = 0; i < xmlNode.childNodes.length; i++) {
var currNode = xmlNode.childNodes[i];
// if it's a text node or a CDATA section use the nodeValue directly
if (currNode.nodeType != 3 && currNode.nodeType != 4) {
var name = currNode.nodeName;
var count = 0;
for (var j = 0; j < xmlNode.childNodes.length; j++) {
if (xmlNode.childNodes[j].nodeName == name) {
if (++count == 2) {
break;
}
}
}
var el = this.__parseXmlNode(currNode);
if (count == 2) {
if (node[name] == null) {
node[name] = [];
}
node[name].push(el);
} else {
node[name] = el;
}
} else if (xmlNode.childNodes.length == 1) {
node = currNode.nodeValue;
}
}
return node;
} | [
"function",
"(",
"xmlNode",
")",
"{",
"if",
"(",
"!",
"xmlNode",
")",
"{",
"return",
";",
"}",
"var",
"node",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"xmlNode",
".",
"childNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"currNode",
"=",
"xmlNode",
".",
"childNodes",
"[",
"i",
"]",
";",
"if",
"(",
"currNode",
".",
"nodeType",
"!=",
"3",
"&&",
"currNode",
".",
"nodeType",
"!=",
"4",
")",
"{",
"var",
"name",
"=",
"currNode",
".",
"nodeName",
";",
"var",
"count",
"=",
"0",
";",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"xmlNode",
".",
"childNodes",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"xmlNode",
".",
"childNodes",
"[",
"j",
"]",
".",
"nodeName",
"==",
"name",
")",
"{",
"if",
"(",
"++",
"count",
"==",
"2",
")",
"{",
"break",
";",
"}",
"}",
"}",
"var",
"el",
"=",
"this",
".",
"__parseXmlNode",
"(",
"currNode",
")",
";",
"if",
"(",
"count",
"==",
"2",
")",
"{",
"if",
"(",
"node",
"[",
"name",
"]",
"==",
"null",
")",
"{",
"node",
"[",
"name",
"]",
"=",
"[",
"]",
";",
"}",
"node",
"[",
"name",
"]",
".",
"push",
"(",
"el",
")",
";",
"}",
"else",
"{",
"node",
"[",
"name",
"]",
"=",
"el",
";",
"}",
"}",
"else",
"if",
"(",
"xmlNode",
".",
"childNodes",
".",
"length",
"==",
"1",
")",
"{",
"node",
"=",
"currNode",
".",
"nodeValue",
";",
"}",
"}",
"return",
"node",
";",
"}"
]
| Internal method used for parsing the nodes of a xml document
@param {XmlNode} xmlNode Xml node to be parsed
@return {Object} Json object representing a xml node | [
"Internal",
"method",
"used",
"for",
"parsing",
"the",
"nodes",
"of",
"a",
"xml",
"document"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Xml.js#L69-L103 | train |
|
ariatemplates/ariatemplates | src/aria/utils/overlay/LoadingOverlay.js | function (element, overlayId, options) {
// ------------------------------------------ input arguments processing
if (options == null) {
options = {};
}
if (ariaUtilsType.isString(options)) {
options = {message: options};
}
var waiAria = options.waiAria;
var message = options.message;
this.__text = message;
var waiAriaReadInterval = options.waiAriaReadInterval;
if (waiAriaReadInterval == null) {
waiAriaReadInterval = 2000;
}
this._waiAriaReadInterval = waiAriaReadInterval;
var waiAriaReadOnceFirst = options.waiAriaReadOnceFirst;
if (waiAriaReadOnceFirst == null) {
waiAriaReadOnceFirst = true;
}
this._waiAriaReadOnceFirst = waiAriaReadOnceFirst;
// ---------------------------------------------------------- processing
this.$Overlay.constructor.call(this, element, {
id : overlayId,
className : "xLDI"
}, {
waiAria: waiAria
});
var browser = aria.core.Browser;
// fix 08364518 : if IE<9, the scroll event on an element does not bubble up and trigger the handler
// attached to the window
if (browser.isIE8 || browser.isIE7) {
this._scrollRecListener = true;
ariaUtilsEvent.addListenerRecursivelyUp(this.element, "scroll", {
fn : this.refreshPosition,
scope : this
}, true, function (element) {
return element.style && element.style.overflow != "hidden";
});
}
} | javascript | function (element, overlayId, options) {
// ------------------------------------------ input arguments processing
if (options == null) {
options = {};
}
if (ariaUtilsType.isString(options)) {
options = {message: options};
}
var waiAria = options.waiAria;
var message = options.message;
this.__text = message;
var waiAriaReadInterval = options.waiAriaReadInterval;
if (waiAriaReadInterval == null) {
waiAriaReadInterval = 2000;
}
this._waiAriaReadInterval = waiAriaReadInterval;
var waiAriaReadOnceFirst = options.waiAriaReadOnceFirst;
if (waiAriaReadOnceFirst == null) {
waiAriaReadOnceFirst = true;
}
this._waiAriaReadOnceFirst = waiAriaReadOnceFirst;
// ---------------------------------------------------------- processing
this.$Overlay.constructor.call(this, element, {
id : overlayId,
className : "xLDI"
}, {
waiAria: waiAria
});
var browser = aria.core.Browser;
// fix 08364518 : if IE<9, the scroll event on an element does not bubble up and trigger the handler
// attached to the window
if (browser.isIE8 || browser.isIE7) {
this._scrollRecListener = true;
ariaUtilsEvent.addListenerRecursivelyUp(this.element, "scroll", {
fn : this.refreshPosition,
scope : this
}, true, function (element) {
return element.style && element.style.overflow != "hidden";
});
}
} | [
"function",
"(",
"element",
",",
"overlayId",
",",
"options",
")",
"{",
"if",
"(",
"options",
"==",
"null",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"ariaUtilsType",
".",
"isString",
"(",
"options",
")",
")",
"{",
"options",
"=",
"{",
"message",
":",
"options",
"}",
";",
"}",
"var",
"waiAria",
"=",
"options",
".",
"waiAria",
";",
"var",
"message",
"=",
"options",
".",
"message",
";",
"this",
".",
"__text",
"=",
"message",
";",
"var",
"waiAriaReadInterval",
"=",
"options",
".",
"waiAriaReadInterval",
";",
"if",
"(",
"waiAriaReadInterval",
"==",
"null",
")",
"{",
"waiAriaReadInterval",
"=",
"2000",
";",
"}",
"this",
".",
"_waiAriaReadInterval",
"=",
"waiAriaReadInterval",
";",
"var",
"waiAriaReadOnceFirst",
"=",
"options",
".",
"waiAriaReadOnceFirst",
";",
"if",
"(",
"waiAriaReadOnceFirst",
"==",
"null",
")",
"{",
"waiAriaReadOnceFirst",
"=",
"true",
";",
"}",
"this",
".",
"_waiAriaReadOnceFirst",
"=",
"waiAriaReadOnceFirst",
";",
"this",
".",
"$Overlay",
".",
"constructor",
".",
"call",
"(",
"this",
",",
"element",
",",
"{",
"id",
":",
"overlayId",
",",
"className",
":",
"\"xLDI\"",
"}",
",",
"{",
"waiAria",
":",
"waiAria",
"}",
")",
";",
"var",
"browser",
"=",
"aria",
".",
"core",
".",
"Browser",
";",
"if",
"(",
"browser",
".",
"isIE8",
"||",
"browser",
".",
"isIE7",
")",
"{",
"this",
".",
"_scrollRecListener",
"=",
"true",
";",
"ariaUtilsEvent",
".",
"addListenerRecursivelyUp",
"(",
"this",
".",
"element",
",",
"\"scroll\"",
",",
"{",
"fn",
":",
"this",
".",
"refreshPosition",
",",
"scope",
":",
"this",
"}",
",",
"true",
",",
"function",
"(",
"element",
")",
"{",
"return",
"element",
".",
"style",
"&&",
"element",
".",
"style",
".",
"overflow",
"!=",
"\"hidden\"",
";",
"}",
")",
";",
"}",
"}"
]
| Creates a loading overlay above a DOM Element.
<p>The options object contains the following properties: </p>
<ul>
<li><em>message</em>: the message to display</li>
<li><em>waiAria</em>: forwarded to the parent constructor</li>
<li><em>waiAriaReadInterval</em>: when waiAria is activated, the interval (in milliseconds) at which to read the message. Defaults to 2000.</li>
<li><em>waiAriaReadOnceFirst</em>: when waiAria is activated, whether to read the message once first or not. Defaults to <em>true</em>.</li>
</ul>
@param {HTMLElement} element The element that should be hidden by an overlay
@param {String} overlayId The id of the overlay
@param {Object|String} options The optional options, see description for more details. If a string is passed directly it is assumed to be the message. | [
"Creates",
"a",
"loading",
"overlay",
"above",
"a",
"DOM",
"Element",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/overlay/LoadingOverlay.js#L49-L98 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Html.js | function (attributes) {
var result = [], whiteList = ariaTemplatesDomElementWrapper.attributesWhiteList;
var jsonUtils = ariaUtilsJson;
/*
* This assumes that white list is performed by config validation, but this is only available in debug mode :
* FIXME!
*/
var stringUtil = ariaUtilsString;
for (var key in attributes) {
if (attributes.hasOwnProperty(key) && !jsonUtils.isMetadata(key)) {
var attribute = attributes[key];
if (key === "classList") {
result.push(" class=\"");
result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute.join(" ")));
result.push("\"");
} else if (key === "dataset") {
for (var dataKey in attribute) {
if (attribute.hasOwnProperty(dataKey) && !jsonUtils.isMetadata(dataKey)) {
if (this.datasetRegex.test(dataKey)) {
result.push(" data-", stringUtil.camelToDashed(dataKey), "=\"");
result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute[dataKey]));
result.push("\"");
} else {
this.$logError(this.INVALID_DATASET_KEY, dataKey);
}
}
}
} else if (key === "aria") {
for (var ariaKey in attribute) {
if (attribute.hasOwnProperty(ariaKey) && !jsonUtils.isMetadata(ariaKey)) {
result.push(" aria-", ariaKey, "=\"");
result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute[ariaKey]));
result.push("\"");
}
}
} else if (whiteList.test(key)) {
attribute = (attribute != null) ? attribute + "" : "";
result.push(" ", key, "=\"");
result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute));
result.push("\"");
} else {
this.$logError(this.INVALID_CONFIGURATION, key);
}
}
}
return result.join('');
} | javascript | function (attributes) {
var result = [], whiteList = ariaTemplatesDomElementWrapper.attributesWhiteList;
var jsonUtils = ariaUtilsJson;
/*
* This assumes that white list is performed by config validation, but this is only available in debug mode :
* FIXME!
*/
var stringUtil = ariaUtilsString;
for (var key in attributes) {
if (attributes.hasOwnProperty(key) && !jsonUtils.isMetadata(key)) {
var attribute = attributes[key];
if (key === "classList") {
result.push(" class=\"");
result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute.join(" ")));
result.push("\"");
} else if (key === "dataset") {
for (var dataKey in attribute) {
if (attribute.hasOwnProperty(dataKey) && !jsonUtils.isMetadata(dataKey)) {
if (this.datasetRegex.test(dataKey)) {
result.push(" data-", stringUtil.camelToDashed(dataKey), "=\"");
result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute[dataKey]));
result.push("\"");
} else {
this.$logError(this.INVALID_DATASET_KEY, dataKey);
}
}
}
} else if (key === "aria") {
for (var ariaKey in attribute) {
if (attribute.hasOwnProperty(ariaKey) && !jsonUtils.isMetadata(ariaKey)) {
result.push(" aria-", ariaKey, "=\"");
result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute[ariaKey]));
result.push("\"");
}
}
} else if (whiteList.test(key)) {
attribute = (attribute != null) ? attribute + "" : "";
result.push(" ", key, "=\"");
result.push(stringUtil.encodeForQuotedHTMLAttribute(attribute));
result.push("\"");
} else {
this.$logError(this.INVALID_CONFIGURATION, key);
}
}
}
return result.join('');
} | [
"function",
"(",
"attributes",
")",
"{",
"var",
"result",
"=",
"[",
"]",
",",
"whiteList",
"=",
"ariaTemplatesDomElementWrapper",
".",
"attributesWhiteList",
";",
"var",
"jsonUtils",
"=",
"ariaUtilsJson",
";",
"var",
"stringUtil",
"=",
"ariaUtilsString",
";",
"for",
"(",
"var",
"key",
"in",
"attributes",
")",
"{",
"if",
"(",
"attributes",
".",
"hasOwnProperty",
"(",
"key",
")",
"&&",
"!",
"jsonUtils",
".",
"isMetadata",
"(",
"key",
")",
")",
"{",
"var",
"attribute",
"=",
"attributes",
"[",
"key",
"]",
";",
"if",
"(",
"key",
"===",
"\"classList\"",
")",
"{",
"result",
".",
"push",
"(",
"\" class=\\\"\"",
")",
";",
"\\\"",
"result",
".",
"push",
"(",
"stringUtil",
".",
"encodeForQuotedHTMLAttribute",
"(",
"attribute",
".",
"join",
"(",
"\" \"",
")",
")",
")",
";",
"}",
"else",
"result",
".",
"push",
"(",
"\"\\\"\"",
")",
";",
"}",
"}",
"\\\"",
"}"
]
| Build the HTML markup regarding the attributes provided.
@param {aria.templates.CfgBeans:HtmlAttribute} attributes Attributes to be parsed
@return {String} String which can be used directly in a html tag | [
"Build",
"the",
"HTML",
"markup",
"regarding",
"the",
"attributes",
"provided",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Html.js#L39-L86 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Html.js | function (form) {
var elements = form.elements, params = [], element, name, value;
for (var i = 0, len = elements.length; i < len; i++) {
element = elements[i];
if (this._isSerializable(element)) {
name = encodeURIComponent(element.name);
value = encodeURIComponent(element.value.replace(/\r?\n/g, "\r\n"));
params.push(name + "=" + value);
}
}
return params.join("&").replace(/%20/g, "+");
} | javascript | function (form) {
var elements = form.elements, params = [], element, name, value;
for (var i = 0, len = elements.length; i < len; i++) {
element = elements[i];
if (this._isSerializable(element)) {
name = encodeURIComponent(element.name);
value = encodeURIComponent(element.value.replace(/\r?\n/g, "\r\n"));
params.push(name + "=" + value);
}
}
return params.join("&").replace(/%20/g, "+");
} | [
"function",
"(",
"form",
")",
"{",
"var",
"elements",
"=",
"form",
".",
"elements",
",",
"params",
"=",
"[",
"]",
",",
"element",
",",
"name",
",",
"value",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"elements",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"element",
"=",
"elements",
"[",
"i",
"]",
";",
"if",
"(",
"this",
".",
"_isSerializable",
"(",
"element",
")",
")",
"{",
"name",
"=",
"encodeURIComponent",
"(",
"element",
".",
"name",
")",
";",
"value",
"=",
"encodeURIComponent",
"(",
"element",
".",
"value",
".",
"replace",
"(",
"/",
"\\r?\\n",
"/",
"g",
",",
"\"\\r\\n\"",
")",
")",
";",
"\\r",
"}",
"}",
"\\n",
"}"
]
| Turn an HTML form element into a string that contains the list of name-value pairs of all relevant elements
of the form. For example, the following form
<pre>
<form id="myForm">
<input type="text" name="firstname" value="Colin">
<input type="text" name="lastname" value="Pitt" disabled>
<input type="date" name="birth" value="2012-04-04"
<input type="text">
<input type="file" name="picture" />
<input type="submit" name="submit"/>
<input type="checkbox" name="vehicle" value="Bike" checked />
</form>
</pre>
yields
<pre>
firstname
=Colin&birth=2012-04-04&vehicle=Bike
</pre>
This method can be useful when you want to send the form information as data of an ajax call
@param {HTMLElement} form
@return {String} | [
"Turn",
"an",
"HTML",
"form",
"element",
"into",
"a",
"string",
"that",
"contains",
"the",
"list",
"of",
"name",
"-",
"value",
"pairs",
"of",
"all",
"relevant",
"elements",
"of",
"the",
"form",
".",
"For",
"example",
"the",
"following",
"form"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Html.js#L115-L126 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Html.js | function (element) {
var submittable = /^(?:input|select|textarea|keygen)/i;
var submitterTypes = /^(?:submit|button|image|reset|file)$/i;
var type = element.type;
var checkableTypes = /^(?:checkbox|radio)$/i;
return element.name && !element.disabled && submittable.test(element.nodeName)
&& !submitterTypes.test(type) && (element.checked || !checkableTypes.test(type));
} | javascript | function (element) {
var submittable = /^(?:input|select|textarea|keygen)/i;
var submitterTypes = /^(?:submit|button|image|reset|file)$/i;
var type = element.type;
var checkableTypes = /^(?:checkbox|radio)$/i;
return element.name && !element.disabled && submittable.test(element.nodeName)
&& !submitterTypes.test(type) && (element.checked || !checkableTypes.test(type));
} | [
"function",
"(",
"element",
")",
"{",
"var",
"submittable",
"=",
"/",
"^(?:input|select|textarea|keygen)",
"/",
"i",
";",
"var",
"submitterTypes",
"=",
"/",
"^(?:submit|button|image|reset|file)$",
"/",
"i",
";",
"var",
"type",
"=",
"element",
".",
"type",
";",
"var",
"checkableTypes",
"=",
"/",
"^(?:checkbox|radio)$",
"/",
"i",
";",
"return",
"element",
".",
"name",
"&&",
"!",
"element",
".",
"disabled",
"&&",
"submittable",
".",
"test",
"(",
"element",
".",
"nodeName",
")",
"&&",
"!",
"submitterTypes",
".",
"test",
"(",
"type",
")",
"&&",
"(",
"element",
".",
"checked",
"||",
"!",
"checkableTypes",
".",
"test",
"(",
"type",
")",
")",
";",
"}"
]
| Return true if the HTML element is serializable in a form. Serializable elements are input, select, textarea,
keygen, which have a name attribute, a certain type, and are not disabled
@param {HTMLElement} element
@return {Boolean} | [
"Return",
"true",
"if",
"the",
"HTML",
"element",
"is",
"serializable",
"in",
"a",
"form",
".",
"Serializable",
"elements",
"are",
"input",
"select",
"textarea",
"keygen",
"which",
"have",
"a",
"name",
"attribute",
"a",
"certain",
"type",
"and",
"are",
"not",
"disabled"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Html.js#L134-L142 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Html.js | function (domElement, dataset, remove) {
var fullKey, stringUtil = ariaUtilsString;
for (var dataKey in dataset) {
if (dataset.hasOwnProperty(dataKey) && !ariaUtilsJson.isMetadata(dataKey)) {
if (this.datasetRegex.test(dataKey)) {
fullKey = "data-" + stringUtil.camelToDashed(dataKey);
if (remove) {
domElement.removeAttribute(fullKey);
} else {
domElement.setAttribute(fullKey, dataset[dataKey]);
}
} else {
this.$logError(this.INVALID_DATASET_KEY, dataKey);
}
}
}
} | javascript | function (domElement, dataset, remove) {
var fullKey, stringUtil = ariaUtilsString;
for (var dataKey in dataset) {
if (dataset.hasOwnProperty(dataKey) && !ariaUtilsJson.isMetadata(dataKey)) {
if (this.datasetRegex.test(dataKey)) {
fullKey = "data-" + stringUtil.camelToDashed(dataKey);
if (remove) {
domElement.removeAttribute(fullKey);
} else {
domElement.setAttribute(fullKey, dataset[dataKey]);
}
} else {
this.$logError(this.INVALID_DATASET_KEY, dataKey);
}
}
}
} | [
"function",
"(",
"domElement",
",",
"dataset",
",",
"remove",
")",
"{",
"var",
"fullKey",
",",
"stringUtil",
"=",
"ariaUtilsString",
";",
"for",
"(",
"var",
"dataKey",
"in",
"dataset",
")",
"{",
"if",
"(",
"dataset",
".",
"hasOwnProperty",
"(",
"dataKey",
")",
"&&",
"!",
"ariaUtilsJson",
".",
"isMetadata",
"(",
"dataKey",
")",
")",
"{",
"if",
"(",
"this",
".",
"datasetRegex",
".",
"test",
"(",
"dataKey",
")",
")",
"{",
"fullKey",
"=",
"\"data-\"",
"+",
"stringUtil",
".",
"camelToDashed",
"(",
"dataKey",
")",
";",
"if",
"(",
"remove",
")",
"{",
"domElement",
".",
"removeAttribute",
"(",
"fullKey",
")",
";",
"}",
"else",
"{",
"domElement",
".",
"setAttribute",
"(",
"fullKey",
",",
"dataset",
"[",
"dataKey",
"]",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_DATASET_KEY",
",",
"dataKey",
")",
";",
"}",
"}",
"}",
"}"
]
| Set or remove "data-" attributes
@param {HTMLElement} domElement
@param {Object} dataset
@param {Boolean} remove if false or undefined, attributes will be set instead | [
"Set",
"or",
"remove",
"data",
"-",
"attributes"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Html.js#L168-L184 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function () {
if (this._simpleHTML) {
return this._skinObj.states[this._state].color;
}
if (this._isIE7OrLess) {
// As "inherit" does not work in this case in IE7, we are obliged to read the property from
// the frame state and apply it to the text field directly
var state = this._skinObj.states[this._state];
return state.color || state.frame.color;
}
return "inherit";
} | javascript | function () {
if (this._simpleHTML) {
return this._skinObj.states[this._state].color;
}
if (this._isIE7OrLess) {
// As "inherit" does not work in this case in IE7, we are obliged to read the property from
// the frame state and apply it to the text field directly
var state = this._skinObj.states[this._state];
return state.color || state.frame.color;
}
return "inherit";
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_simpleHTML",
")",
"{",
"return",
"this",
".",
"_skinObj",
".",
"states",
"[",
"this",
".",
"_state",
"]",
".",
"color",
";",
"}",
"if",
"(",
"this",
".",
"_isIE7OrLess",
")",
"{",
"var",
"state",
"=",
"this",
".",
"_skinObj",
".",
"states",
"[",
"this",
".",
"_state",
"]",
";",
"return",
"state",
".",
"color",
"||",
"state",
".",
"frame",
".",
"color",
";",
"}",
"return",
"\"inherit\"",
";",
"}"
]
| Get the color to be set on the text field for the current state, if the helptext is not enabled.
@protected | [
"Get",
"the",
"color",
"to",
"be",
"set",
"on",
"the",
"text",
"field",
"for",
"the",
"current",
"state",
"if",
"the",
"helptext",
"is",
"not",
"enabled",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L203-L214 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function () {
var cfg = this._cfg;
// invalid text and value shouldn't be set at the same time
var text = cfg.invalidText || "";
if (text && cfg.value) {
// There's both a value and an invalid text, prefer the value
this.setProperty("invalidText", null);
text = "";
}
// Validate the value in the configuration
var res = this.checkValue({
text : text,
value : cfg.value,
performCheckOnly : true
});
if (res.report) {
var report = res.report;
if (!text && report.text != null) {
text = '' + report.text; // String cast of valid value
}
report.$dispose();
}
if (!text) {
text = this._getPrefilledText(cfg.prefill);
}
return text;
} | javascript | function () {
var cfg = this._cfg;
// invalid text and value shouldn't be set at the same time
var text = cfg.invalidText || "";
if (text && cfg.value) {
// There's both a value and an invalid text, prefer the value
this.setProperty("invalidText", null);
text = "";
}
// Validate the value in the configuration
var res = this.checkValue({
text : text,
value : cfg.value,
performCheckOnly : true
});
if (res.report) {
var report = res.report;
if (!text && report.text != null) {
text = '' + report.text; // String cast of valid value
}
report.$dispose();
}
if (!text) {
text = this._getPrefilledText(cfg.prefill);
}
return text;
} | [
"function",
"(",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"var",
"text",
"=",
"cfg",
".",
"invalidText",
"||",
"\"\"",
";",
"if",
"(",
"text",
"&&",
"cfg",
".",
"value",
")",
"{",
"this",
".",
"setProperty",
"(",
"\"invalidText\"",
",",
"null",
")",
";",
"text",
"=",
"\"\"",
";",
"}",
"var",
"res",
"=",
"this",
".",
"checkValue",
"(",
"{",
"text",
":",
"text",
",",
"value",
":",
"cfg",
".",
"value",
",",
"performCheckOnly",
":",
"true",
"}",
")",
";",
"if",
"(",
"res",
".",
"report",
")",
"{",
"var",
"report",
"=",
"res",
".",
"report",
";",
"if",
"(",
"!",
"text",
"&&",
"report",
".",
"text",
"!=",
"null",
")",
"{",
"text",
"=",
"''",
"+",
"report",
".",
"text",
";",
"}",
"report",
".",
"$dispose",
"(",
")",
";",
"}",
"if",
"(",
"!",
"text",
")",
"{",
"text",
"=",
"this",
".",
"_getPrefilledText",
"(",
"cfg",
".",
"prefill",
")",
";",
"}",
"return",
"text",
";",
"}"
]
| Get the text value of the input field. If available it tries to use the internal valid value, otherwise uses
the invalid text. If none of them is a non empty string it return the prefilled value. This method doesn't
handle helptext, as this value is not just text but also style.
@return {String} | [
"Get",
"the",
"text",
"value",
"of",
"the",
"input",
"field",
".",
"If",
"available",
"it",
"tries",
"to",
"use",
"the",
"internal",
"valid",
"value",
"otherwise",
"uses",
"the",
"invalid",
"text",
".",
"If",
"none",
"of",
"them",
"is",
"a",
"non",
"empty",
"string",
"it",
"return",
"the",
"prefilled",
"value",
".",
"This",
"method",
"doesn",
"t",
"handle",
"helptext",
"as",
"this",
"value",
"is",
"not",
"just",
"text",
"but",
"also",
"style",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L239-L270 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (value) {
if (value == null) {
value = this._getText();
}
// _getText only handles valid / invalid values and prefills, not the helptext
if (!value && !this._isPassword) {
// We don't want to handle helptext in password fields, first remove any text
this.getTextInputField().value = "";
this.setHelpText(true);
} else if (value) {
this.setHelpText(false);
this.getTextInputField().value = value;
}
} | javascript | function (value) {
if (value == null) {
value = this._getText();
}
// _getText only handles valid / invalid values and prefills, not the helptext
if (!value && !this._isPassword) {
// We don't want to handle helptext in password fields, first remove any text
this.getTextInputField().value = "";
this.setHelpText(true);
} else if (value) {
this.setHelpText(false);
this.getTextInputField().value = value;
}
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"this",
".",
"_getText",
"(",
")",
";",
"}",
"if",
"(",
"!",
"value",
"&&",
"!",
"this",
".",
"_isPassword",
")",
"{",
"this",
".",
"getTextInputField",
"(",
")",
".",
"value",
"=",
"\"\"",
";",
"this",
".",
"setHelpText",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"value",
")",
"{",
"this",
".",
"setHelpText",
"(",
"false",
")",
";",
"this",
".",
"getTextInputField",
"(",
")",
".",
"value",
"=",
"value",
";",
"}",
"}"
]
| Set a given text as value for the text input. This method handles helptext for non password fields.
@param {String} value Text to be set, if empty uses the value from <code>this._getText</code> or the
helptext | [
"Set",
"a",
"given",
"text",
"as",
"value",
"for",
"the",
"text",
"input",
".",
"This",
"method",
"handles",
"helptext",
"for",
"non",
"password",
"fields",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L277-L291 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (event) {
if (this._keepFocus || this._hasFocus) {
this._reactToControllerReport(event.report, event.arg);
} else if (event.report) {
event.report.$dispose();
}
} | javascript | function (event) {
if (this._keepFocus || this._hasFocus) {
this._reactToControllerReport(event.report, event.arg);
} else if (event.report) {
event.report.$dispose();
}
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"this",
".",
"_keepFocus",
"||",
"this",
".",
"_hasFocus",
")",
"{",
"this",
".",
"_reactToControllerReport",
"(",
"event",
".",
"report",
",",
"event",
".",
"arg",
")",
";",
"}",
"else",
"if",
"(",
"event",
".",
"report",
")",
"{",
"event",
".",
"report",
".",
"$dispose",
"(",
")",
";",
"}",
"}"
]
| Callback for asynchronous controller reporting
@param {Object} event controller onCheck event
@protected | [
"Callback",
"for",
"asynchronous",
"controller",
"reporting"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L520-L526 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (report, arg) {
var hasChange = false, cfg = this._cfg;
if (report) {
var resetErrorIfOK = true;
var hasFocus = this._hasFocus;
var stopValueProp = false;
var delayedValidation = false;
if (arg) {
resetErrorIfOK = (arg.resetErrorIfOK !== false); // true by default
if (arg.hasFocus != null) {
// replace default hasFocus property
hasFocus = arg.hasFocus;
}
if (arg.stopValueProp) {
stopValueProp = arg.stopValueProp;
}
if (arg.delayedValidation) {
delayedValidation = arg.delayedValidation;
}
}
if (report.errorMessages.length && this._cfg.directOnBlurValidation) {
this.changeProperty("formatErrorMessages", report.errorMessages);
}
// if the validation originated from a validation with delay we
// do not want to update the input text or
// value. The value will be set to 'undefined' though when the
// entry is incorrect
if (!delayedValidation) {
var text = report.text, value = report.value;
if (text != null && !this._helpTextSet) { // if text was
// an empty string (helpTextSet is 'true') do not update
// the display
var caretPosition = (report.caretPosStart != null && report.caretPosEnd != null) ? {
start : report.caretPosStart,
end : report.caretPosEnd
} : null;
if (ariaCoreBrowser.isModernIE && !caretPosition) {
caretPosition = this.getCaretPosition();
}
var input = this.getTextInputField();
// This test prevents the normal autofocus from being lost with tab, in some browsers
if (input.value != text) {
input.value = text;
}
if (caretPosition) {
this.setCaretPosition(caretPosition.start, caretPosition.end);
}
}
if (typeof value != 'undefined' && !stopValueProp && !this._isPropertyEquals("value", value)) {
hasChange = this.setProperty("value", value);
}
}
// setProperty on value can dispose the widget
if (this._cfg) {
if (report.ok) {
if (resetErrorIfOK && cfg.directOnBlurValidation) {
this.changeProperty("formatError", false);
}
} else if (report.ok === false) {
if (hasFocus && report.matchCorrectValueStart) {
// field has the focus and entry could be correct
if (cfg.directOnBlurValidation) {
this.changeProperty("formatError", false);
}
} else {
if (cfg.directOnBlurValidation) {
this.changeProperty("formatError", true);
}
}
// if the text is incorrect, the bound property should
// be set to 'undefined'
if (!this._isPropertyEquals("value", report.errorValue)) {
hasChange = this.setProperty("value", report.errorValue);
}
}
}
// do this at the very end
if (hasChange && this._cfg) {
// When the user modifies the field, we reset the error
// state until next validation:
this.changeProperty("error", false);
this.evalCallback(cfg.onchange);
}
report.$dispose();
}
} | javascript | function (report, arg) {
var hasChange = false, cfg = this._cfg;
if (report) {
var resetErrorIfOK = true;
var hasFocus = this._hasFocus;
var stopValueProp = false;
var delayedValidation = false;
if (arg) {
resetErrorIfOK = (arg.resetErrorIfOK !== false); // true by default
if (arg.hasFocus != null) {
// replace default hasFocus property
hasFocus = arg.hasFocus;
}
if (arg.stopValueProp) {
stopValueProp = arg.stopValueProp;
}
if (arg.delayedValidation) {
delayedValidation = arg.delayedValidation;
}
}
if (report.errorMessages.length && this._cfg.directOnBlurValidation) {
this.changeProperty("formatErrorMessages", report.errorMessages);
}
// if the validation originated from a validation with delay we
// do not want to update the input text or
// value. The value will be set to 'undefined' though when the
// entry is incorrect
if (!delayedValidation) {
var text = report.text, value = report.value;
if (text != null && !this._helpTextSet) { // if text was
// an empty string (helpTextSet is 'true') do not update
// the display
var caretPosition = (report.caretPosStart != null && report.caretPosEnd != null) ? {
start : report.caretPosStart,
end : report.caretPosEnd
} : null;
if (ariaCoreBrowser.isModernIE && !caretPosition) {
caretPosition = this.getCaretPosition();
}
var input = this.getTextInputField();
// This test prevents the normal autofocus from being lost with tab, in some browsers
if (input.value != text) {
input.value = text;
}
if (caretPosition) {
this.setCaretPosition(caretPosition.start, caretPosition.end);
}
}
if (typeof value != 'undefined' && !stopValueProp && !this._isPropertyEquals("value", value)) {
hasChange = this.setProperty("value", value);
}
}
// setProperty on value can dispose the widget
if (this._cfg) {
if (report.ok) {
if (resetErrorIfOK && cfg.directOnBlurValidation) {
this.changeProperty("formatError", false);
}
} else if (report.ok === false) {
if (hasFocus && report.matchCorrectValueStart) {
// field has the focus and entry could be correct
if (cfg.directOnBlurValidation) {
this.changeProperty("formatError", false);
}
} else {
if (cfg.directOnBlurValidation) {
this.changeProperty("formatError", true);
}
}
// if the text is incorrect, the bound property should
// be set to 'undefined'
if (!this._isPropertyEquals("value", report.errorValue)) {
hasChange = this.setProperty("value", report.errorValue);
}
}
}
// do this at the very end
if (hasChange && this._cfg) {
// When the user modifies the field, we reset the error
// state until next validation:
this.changeProperty("error", false);
this.evalCallback(cfg.onchange);
}
report.$dispose();
}
} | [
"function",
"(",
"report",
",",
"arg",
")",
"{",
"var",
"hasChange",
"=",
"false",
",",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"if",
"(",
"report",
")",
"{",
"var",
"resetErrorIfOK",
"=",
"true",
";",
"var",
"hasFocus",
"=",
"this",
".",
"_hasFocus",
";",
"var",
"stopValueProp",
"=",
"false",
";",
"var",
"delayedValidation",
"=",
"false",
";",
"if",
"(",
"arg",
")",
"{",
"resetErrorIfOK",
"=",
"(",
"arg",
".",
"resetErrorIfOK",
"!==",
"false",
")",
";",
"if",
"(",
"arg",
".",
"hasFocus",
"!=",
"null",
")",
"{",
"hasFocus",
"=",
"arg",
".",
"hasFocus",
";",
"}",
"if",
"(",
"arg",
".",
"stopValueProp",
")",
"{",
"stopValueProp",
"=",
"arg",
".",
"stopValueProp",
";",
"}",
"if",
"(",
"arg",
".",
"delayedValidation",
")",
"{",
"delayedValidation",
"=",
"arg",
".",
"delayedValidation",
";",
"}",
"}",
"if",
"(",
"report",
".",
"errorMessages",
".",
"length",
"&&",
"this",
".",
"_cfg",
".",
"directOnBlurValidation",
")",
"{",
"this",
".",
"changeProperty",
"(",
"\"formatErrorMessages\"",
",",
"report",
".",
"errorMessages",
")",
";",
"}",
"if",
"(",
"!",
"delayedValidation",
")",
"{",
"var",
"text",
"=",
"report",
".",
"text",
",",
"value",
"=",
"report",
".",
"value",
";",
"if",
"(",
"text",
"!=",
"null",
"&&",
"!",
"this",
".",
"_helpTextSet",
")",
"{",
"var",
"caretPosition",
"=",
"(",
"report",
".",
"caretPosStart",
"!=",
"null",
"&&",
"report",
".",
"caretPosEnd",
"!=",
"null",
")",
"?",
"{",
"start",
":",
"report",
".",
"caretPosStart",
",",
"end",
":",
"report",
".",
"caretPosEnd",
"}",
":",
"null",
";",
"if",
"(",
"ariaCoreBrowser",
".",
"isModernIE",
"&&",
"!",
"caretPosition",
")",
"{",
"caretPosition",
"=",
"this",
".",
"getCaretPosition",
"(",
")",
";",
"}",
"var",
"input",
"=",
"this",
".",
"getTextInputField",
"(",
")",
";",
"if",
"(",
"input",
".",
"value",
"!=",
"text",
")",
"{",
"input",
".",
"value",
"=",
"text",
";",
"}",
"if",
"(",
"caretPosition",
")",
"{",
"this",
".",
"setCaretPosition",
"(",
"caretPosition",
".",
"start",
",",
"caretPosition",
".",
"end",
")",
";",
"}",
"}",
"if",
"(",
"typeof",
"value",
"!=",
"'undefined'",
"&&",
"!",
"stopValueProp",
"&&",
"!",
"this",
".",
"_isPropertyEquals",
"(",
"\"value\"",
",",
"value",
")",
")",
"{",
"hasChange",
"=",
"this",
".",
"setProperty",
"(",
"\"value\"",
",",
"value",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"_cfg",
")",
"{",
"if",
"(",
"report",
".",
"ok",
")",
"{",
"if",
"(",
"resetErrorIfOK",
"&&",
"cfg",
".",
"directOnBlurValidation",
")",
"{",
"this",
".",
"changeProperty",
"(",
"\"formatError\"",
",",
"false",
")",
";",
"}",
"}",
"else",
"if",
"(",
"report",
".",
"ok",
"===",
"false",
")",
"{",
"if",
"(",
"hasFocus",
"&&",
"report",
".",
"matchCorrectValueStart",
")",
"{",
"if",
"(",
"cfg",
".",
"directOnBlurValidation",
")",
"{",
"this",
".",
"changeProperty",
"(",
"\"formatError\"",
",",
"false",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"cfg",
".",
"directOnBlurValidation",
")",
"{",
"this",
".",
"changeProperty",
"(",
"\"formatError\"",
",",
"true",
")",
";",
"}",
"}",
"if",
"(",
"!",
"this",
".",
"_isPropertyEquals",
"(",
"\"value\"",
",",
"report",
".",
"errorValue",
")",
")",
"{",
"hasChange",
"=",
"this",
".",
"setProperty",
"(",
"\"value\"",
",",
"report",
".",
"errorValue",
")",
";",
"}",
"}",
"}",
"if",
"(",
"hasChange",
"&&",
"this",
".",
"_cfg",
")",
"{",
"this",
".",
"changeProperty",
"(",
"\"error\"",
",",
"false",
")",
";",
"this",
".",
"evalCallback",
"(",
"cfg",
".",
"onchange",
")",
";",
"}",
"report",
".",
"$dispose",
"(",
")",
";",
"}",
"}"
]
| React to a Controller report. The widget's controller generates a report on the internal status of the
widget. This function reads the report and sets some properties of the widget. It also reacts to changes in
the internal datamodel.
@param {aria.widgets.controllers.reports.ControllerReport} report
@param {Object} arg Optional parameters
@protected | [
"React",
"to",
"a",
"Controller",
"report",
".",
"The",
"widget",
"s",
"controller",
"generates",
"a",
"report",
"on",
"the",
"internal",
"status",
"of",
"the",
"widget",
".",
"This",
"function",
"reads",
"the",
"report",
"and",
"sets",
"some",
"properties",
"of",
"the",
"widget",
".",
"It",
"also",
"reacts",
"to",
"changes",
"in",
"the",
"internal",
"datamodel",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L536-L629 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (event) {
if (this._cfg.validationDelay) {
if (this._valTimer) {
ariaCoreTimer.cancelCallback(this._valTimer);
}
this._valTimer = ariaCoreTimer.addCallback({
fn : this.checkValue,
scope : this,
args : {
delayedValidation : true
},
delay : this._cfg.validationDelay
});
}
} | javascript | function (event) {
if (this._cfg.validationDelay) {
if (this._valTimer) {
ariaCoreTimer.cancelCallback(this._valTimer);
}
this._valTimer = ariaCoreTimer.addCallback({
fn : this.checkValue,
scope : this,
args : {
delayedValidation : true
},
delay : this._cfg.validationDelay
});
}
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"this",
".",
"_cfg",
".",
"validationDelay",
")",
"{",
"if",
"(",
"this",
".",
"_valTimer",
")",
"{",
"ariaCoreTimer",
".",
"cancelCallback",
"(",
"this",
".",
"_valTimer",
")",
";",
"}",
"this",
".",
"_valTimer",
"=",
"ariaCoreTimer",
".",
"addCallback",
"(",
"{",
"fn",
":",
"this",
".",
"checkValue",
",",
"scope",
":",
"this",
",",
"args",
":",
"{",
"delayedValidation",
":",
"true",
"}",
",",
"delay",
":",
"this",
".",
"_cfg",
".",
"validationDelay",
"}",
")",
";",
"}",
"}"
]
| Internal method to handle the onkeyup event. This is called to set the value property in the data model
through the setProperty method that also handles all other widgets bound to this value.
@protected | [
"Internal",
"method",
"to",
"handle",
"the",
"onkeyup",
"event",
".",
"This",
"is",
"called",
"to",
"set",
"the",
"value",
"property",
"in",
"the",
"data",
"model",
"through",
"the",
"setProperty",
"method",
"that",
"also",
"handles",
"all",
"other",
"widgets",
"bound",
"to",
"this",
"value",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L921-L936 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (domEvent) {
if (!!this._cfg.onclick) {
var domEvtWrapper;
if (domEvent) {
domEvtWrapper = new ariaTemplatesDomEventWrapper(domEvent);
}
this.evalCallback(this._cfg.onclick, domEvtWrapper);
if (domEvtWrapper) {
domEvtWrapper.$dispose();
}
}
} | javascript | function (domEvent) {
if (!!this._cfg.onclick) {
var domEvtWrapper;
if (domEvent) {
domEvtWrapper = new ariaTemplatesDomEventWrapper(domEvent);
}
this.evalCallback(this._cfg.onclick, domEvtWrapper);
if (domEvtWrapper) {
domEvtWrapper.$dispose();
}
}
} | [
"function",
"(",
"domEvent",
")",
"{",
"if",
"(",
"!",
"!",
"this",
".",
"_cfg",
".",
"onclick",
")",
"{",
"var",
"domEvtWrapper",
";",
"if",
"(",
"domEvent",
")",
"{",
"domEvtWrapper",
"=",
"new",
"ariaTemplatesDomEventWrapper",
"(",
"domEvent",
")",
";",
"}",
"this",
".",
"evalCallback",
"(",
"this",
".",
"_cfg",
".",
"onclick",
",",
"domEvtWrapper",
")",
";",
"if",
"(",
"domEvtWrapper",
")",
"{",
"domEvtWrapper",
".",
"$dispose",
"(",
")",
";",
"}",
"}",
"}"
]
| DOM callback function called when the widget has been clicked on. The onclick handles the selection of a text
input widget if the autoselect property has been set to true.
@protected | [
"DOM",
"callback",
"function",
"called",
"when",
"the",
"widget",
"has",
"been",
"clicked",
"on",
".",
"The",
"onclick",
"handles",
"the",
"selection",
"of",
"a",
"text",
"input",
"widget",
"if",
"the",
"autoselect",
"property",
"has",
"been",
"set",
"to",
"true",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L943-L954 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (event, avoidCallback) {
this._hasFocus = true;
if (!this._keepFocus) {
var cfg = this._cfg;
if (cfg.readOnly) {
return;
}
this.setHelpText(false);
if (this._isPrefilled) {
this.setPrefillText(false);
this.checkValue({
value : cfg.prefill
});
}
this.checkValue({
stopValueProp : true
});
if (this._cfg) {
cfg = this._cfg;
if (cfg.validationEvent === 'onFocus'
&& ((cfg.formatError && cfg.formatErrorMessages.length) || (cfg.error && cfg.errorMessages.length))) {
this._validationPopupShow();
}
}
this._updateState();
} else {
// restore selection
var caretPosition = this._currentCaretPosition;
this._currentCaretPosition = null;
if (caretPosition) {
this.setCaretPosition(caretPosition.start, caretPosition.end);
}
}
if (!!this._cfg.onfocus && !avoidCallback) {
this.evalCallback(this._cfg.onfocus);
}
// on IE9 and IE10, it is necessary to add some delay before being able to set the selection
ariaCoreTimer.addCallback({
fn : this._autoselect,
scope : this,
delay : 1
});
} | javascript | function (event, avoidCallback) {
this._hasFocus = true;
if (!this._keepFocus) {
var cfg = this._cfg;
if (cfg.readOnly) {
return;
}
this.setHelpText(false);
if (this._isPrefilled) {
this.setPrefillText(false);
this.checkValue({
value : cfg.prefill
});
}
this.checkValue({
stopValueProp : true
});
if (this._cfg) {
cfg = this._cfg;
if (cfg.validationEvent === 'onFocus'
&& ((cfg.formatError && cfg.formatErrorMessages.length) || (cfg.error && cfg.errorMessages.length))) {
this._validationPopupShow();
}
}
this._updateState();
} else {
// restore selection
var caretPosition = this._currentCaretPosition;
this._currentCaretPosition = null;
if (caretPosition) {
this.setCaretPosition(caretPosition.start, caretPosition.end);
}
}
if (!!this._cfg.onfocus && !avoidCallback) {
this.evalCallback(this._cfg.onfocus);
}
// on IE9 and IE10, it is necessary to add some delay before being able to set the selection
ariaCoreTimer.addCallback({
fn : this._autoselect,
scope : this,
delay : 1
});
} | [
"function",
"(",
"event",
",",
"avoidCallback",
")",
"{",
"this",
".",
"_hasFocus",
"=",
"true",
";",
"if",
"(",
"!",
"this",
".",
"_keepFocus",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"if",
"(",
"cfg",
".",
"readOnly",
")",
"{",
"return",
";",
"}",
"this",
".",
"setHelpText",
"(",
"false",
")",
";",
"if",
"(",
"this",
".",
"_isPrefilled",
")",
"{",
"this",
".",
"setPrefillText",
"(",
"false",
")",
";",
"this",
".",
"checkValue",
"(",
"{",
"value",
":",
"cfg",
".",
"prefill",
"}",
")",
";",
"}",
"this",
".",
"checkValue",
"(",
"{",
"stopValueProp",
":",
"true",
"}",
")",
";",
"if",
"(",
"this",
".",
"_cfg",
")",
"{",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"if",
"(",
"cfg",
".",
"validationEvent",
"===",
"'onFocus'",
"&&",
"(",
"(",
"cfg",
".",
"formatError",
"&&",
"cfg",
".",
"formatErrorMessages",
".",
"length",
")",
"||",
"(",
"cfg",
".",
"error",
"&&",
"cfg",
".",
"errorMessages",
".",
"length",
")",
")",
")",
"{",
"this",
".",
"_validationPopupShow",
"(",
")",
";",
"}",
"}",
"this",
".",
"_updateState",
"(",
")",
";",
"}",
"else",
"{",
"var",
"caretPosition",
"=",
"this",
".",
"_currentCaretPosition",
";",
"this",
".",
"_currentCaretPosition",
"=",
"null",
";",
"if",
"(",
"caretPosition",
")",
"{",
"this",
".",
"setCaretPosition",
"(",
"caretPosition",
".",
"start",
",",
"caretPosition",
".",
"end",
")",
";",
"}",
"}",
"if",
"(",
"!",
"!",
"this",
".",
"_cfg",
".",
"onfocus",
"&&",
"!",
"avoidCallback",
")",
"{",
"this",
".",
"evalCallback",
"(",
"this",
".",
"_cfg",
".",
"onfocus",
")",
";",
"}",
"ariaCoreTimer",
".",
"addCallback",
"(",
"{",
"fn",
":",
"this",
".",
"_autoselect",
",",
"scope",
":",
"this",
",",
"delay",
":",
"1",
"}",
")",
";",
"}"
]
| DOM callback function called when the focus is put on the input. The onFocus event is available on the input
that sits inside a span. In this function, we change the background on the parent span node, and also the
second span that has the end of the input.
@param {aria.DomEvent} event Focus event
@protected | [
"DOM",
"callback",
"function",
"called",
"when",
"the",
"focus",
"is",
"put",
"on",
"the",
"input",
".",
"The",
"onFocus",
"event",
"is",
"available",
"on",
"the",
"input",
"that",
"sits",
"inside",
"a",
"span",
".",
"In",
"this",
"function",
"we",
"change",
"the",
"background",
"on",
"the",
"parent",
"span",
"node",
"and",
"also",
"the",
"second",
"span",
"that",
"has",
"the",
"end",
"of",
"the",
"input",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L963-L1011 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (event, avoidCallback) {
if (!this._hasFocus) {
return;
}
if (!this._keepFocus) {
var cfg = this._cfg; // , htc = this._skinObj.helpText;
this._hasFocus = false;
// reinitialize for next time (autoselect feature)
this._firstFocus = true;
if (cfg.readOnly) {
return;
}
this.checkValue({
"eventName" : "blur"
});
// checkvalue might trigger an onchange that disposes the widget, check again this._cfg
cfg = this._cfg;
if (!cfg) {
return;
}
if (cfg.prefill) {
this.setPrefillText(true, cfg.prefill, false);
} else {
this.setHelpText(true);
}
this._updateState();
if (cfg.formatError && cfg.validationEvent === 'onBlur') {
// show errortip on blur used for debug purposes
this._validationPopupShow();
} else {
// dispose of error tip
this._validationPopupHide();
if (cfg.directOnBlurValidation) {
if (cfg.bind) {
var bind = cfg.bind.value;
if (bind) {
var dataholder = bind.inside;
var name = bind.to;
var groups = cfg.validationGroups;
ariaUtilsData.validateValue(dataholder, name, null, groups, 'onblur');
// PTR05705466: validateValue could have triggered widget dispose, need to re-check
// this._cfg before continuing
if (!this._cfg) {
return;
}
}
}
}
}
} else {
this._currentCaretPosition = this.getCaretPosition();
// this._hasFocus = false must be after the call of this.getCaretPosition()
this._hasFocus = false;
}
if (this._cfg.onblur && !avoidCallback) {
this.evalCallback(this._cfg.onblur);
}
} | javascript | function (event, avoidCallback) {
if (!this._hasFocus) {
return;
}
if (!this._keepFocus) {
var cfg = this._cfg; // , htc = this._skinObj.helpText;
this._hasFocus = false;
// reinitialize for next time (autoselect feature)
this._firstFocus = true;
if (cfg.readOnly) {
return;
}
this.checkValue({
"eventName" : "blur"
});
// checkvalue might trigger an onchange that disposes the widget, check again this._cfg
cfg = this._cfg;
if (!cfg) {
return;
}
if (cfg.prefill) {
this.setPrefillText(true, cfg.prefill, false);
} else {
this.setHelpText(true);
}
this._updateState();
if (cfg.formatError && cfg.validationEvent === 'onBlur') {
// show errortip on blur used for debug purposes
this._validationPopupShow();
} else {
// dispose of error tip
this._validationPopupHide();
if (cfg.directOnBlurValidation) {
if (cfg.bind) {
var bind = cfg.bind.value;
if (bind) {
var dataholder = bind.inside;
var name = bind.to;
var groups = cfg.validationGroups;
ariaUtilsData.validateValue(dataholder, name, null, groups, 'onblur');
// PTR05705466: validateValue could have triggered widget dispose, need to re-check
// this._cfg before continuing
if (!this._cfg) {
return;
}
}
}
}
}
} else {
this._currentCaretPosition = this.getCaretPosition();
// this._hasFocus = false must be after the call of this.getCaretPosition()
this._hasFocus = false;
}
if (this._cfg.onblur && !avoidCallback) {
this.evalCallback(this._cfg.onblur);
}
} | [
"function",
"(",
"event",
",",
"avoidCallback",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_hasFocus",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"this",
".",
"_keepFocus",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"this",
".",
"_hasFocus",
"=",
"false",
";",
"this",
".",
"_firstFocus",
"=",
"true",
";",
"if",
"(",
"cfg",
".",
"readOnly",
")",
"{",
"return",
";",
"}",
"this",
".",
"checkValue",
"(",
"{",
"\"eventName\"",
":",
"\"blur\"",
"}",
")",
";",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"if",
"(",
"!",
"cfg",
")",
"{",
"return",
";",
"}",
"if",
"(",
"cfg",
".",
"prefill",
")",
"{",
"this",
".",
"setPrefillText",
"(",
"true",
",",
"cfg",
".",
"prefill",
",",
"false",
")",
";",
"}",
"else",
"{",
"this",
".",
"setHelpText",
"(",
"true",
")",
";",
"}",
"this",
".",
"_updateState",
"(",
")",
";",
"if",
"(",
"cfg",
".",
"formatError",
"&&",
"cfg",
".",
"validationEvent",
"===",
"'onBlur'",
")",
"{",
"this",
".",
"_validationPopupShow",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"_validationPopupHide",
"(",
")",
";",
"if",
"(",
"cfg",
".",
"directOnBlurValidation",
")",
"{",
"if",
"(",
"cfg",
".",
"bind",
")",
"{",
"var",
"bind",
"=",
"cfg",
".",
"bind",
".",
"value",
";",
"if",
"(",
"bind",
")",
"{",
"var",
"dataholder",
"=",
"bind",
".",
"inside",
";",
"var",
"name",
"=",
"bind",
".",
"to",
";",
"var",
"groups",
"=",
"cfg",
".",
"validationGroups",
";",
"ariaUtilsData",
".",
"validateValue",
"(",
"dataholder",
",",
"name",
",",
"null",
",",
"groups",
",",
"'onblur'",
")",
";",
"if",
"(",
"!",
"this",
".",
"_cfg",
")",
"{",
"return",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"else",
"{",
"this",
".",
"_currentCaretPosition",
"=",
"this",
".",
"getCaretPosition",
"(",
")",
";",
"this",
".",
"_hasFocus",
"=",
"false",
";",
"}",
"if",
"(",
"this",
".",
"_cfg",
".",
"onblur",
"&&",
"!",
"avoidCallback",
")",
"{",
"this",
".",
"evalCallback",
"(",
"this",
".",
"_cfg",
".",
"onblur",
")",
";",
"}",
"}"
]
| DOM callback function called when the focus is taken off the input. The onBlur event is available on the
input that sits inside a span. In this function, we change the background on the parent span node, and also
the second span that has the end of the input.
@param {aria.DomEvent} event Blur event
@protected | [
"DOM",
"callback",
"function",
"called",
"when",
"the",
"focus",
"is",
"taken",
"off",
"the",
"input",
".",
"The",
"onBlur",
"event",
"is",
"available",
"on",
"the",
"input",
"that",
"sits",
"inside",
"a",
"span",
".",
"In",
"this",
"function",
"we",
"change",
"the",
"background",
"on",
"the",
"parent",
"span",
"node",
"and",
"also",
"the",
"second",
"span",
"that",
"has",
"the",
"end",
"of",
"the",
"input",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L1020-L1083 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (enable) {
var cfg = this._cfg;
// check for disposal
if (!cfg) {
return;
}
var helpText = cfg.helptext, helpTextConfig = this._skinObj.helpText;
// stops if no helptext, or trying to disable an helptext that as
// not been set
if (!helpText || !this._helpTextSet && !enable || (this._hasFocus || this._keepFocus) && enable) {
return;
}
var field = this.getTextInputField();
// stops if trying to set a helptext in a field with a value
if (field.value && enable) {
return;
}
this._helpTextSet = enable;
if (!field) {
return;
}
// determine new styles and value
var color = enable ? helpTextConfig.color : this._getTextFieldColor();
var value = enable ? helpText : "";
var helpTextClass = "x" + this._skinnableClass + "_" + cfg.sclass + "_helpText";
var classNames = field.className.split(/\s+/);
ariaUtilsArray.remove(classNames, helpTextClass);
if (enable) {
classNames.push(helpTextClass);
}
field.className = classNames.join(' ');
// update styles
var style = field.style;
style.color = color;
// update field value
field.value = value;
} | javascript | function (enable) {
var cfg = this._cfg;
// check for disposal
if (!cfg) {
return;
}
var helpText = cfg.helptext, helpTextConfig = this._skinObj.helpText;
// stops if no helptext, or trying to disable an helptext that as
// not been set
if (!helpText || !this._helpTextSet && !enable || (this._hasFocus || this._keepFocus) && enable) {
return;
}
var field = this.getTextInputField();
// stops if trying to set a helptext in a field with a value
if (field.value && enable) {
return;
}
this._helpTextSet = enable;
if (!field) {
return;
}
// determine new styles and value
var color = enable ? helpTextConfig.color : this._getTextFieldColor();
var value = enable ? helpText : "";
var helpTextClass = "x" + this._skinnableClass + "_" + cfg.sclass + "_helpText";
var classNames = field.className.split(/\s+/);
ariaUtilsArray.remove(classNames, helpTextClass);
if (enable) {
classNames.push(helpTextClass);
}
field.className = classNames.join(' ');
// update styles
var style = field.style;
style.color = color;
// update field value
field.value = value;
} | [
"function",
"(",
"enable",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"if",
"(",
"!",
"cfg",
")",
"{",
"return",
";",
"}",
"var",
"helpText",
"=",
"cfg",
".",
"helptext",
",",
"helpTextConfig",
"=",
"this",
".",
"_skinObj",
".",
"helpText",
";",
"if",
"(",
"!",
"helpText",
"||",
"!",
"this",
".",
"_helpTextSet",
"&&",
"!",
"enable",
"||",
"(",
"this",
".",
"_hasFocus",
"||",
"this",
".",
"_keepFocus",
")",
"&&",
"enable",
")",
"{",
"return",
";",
"}",
"var",
"field",
"=",
"this",
".",
"getTextInputField",
"(",
")",
";",
"if",
"(",
"field",
".",
"value",
"&&",
"enable",
")",
"{",
"return",
";",
"}",
"this",
".",
"_helpTextSet",
"=",
"enable",
";",
"if",
"(",
"!",
"field",
")",
"{",
"return",
";",
"}",
"var",
"color",
"=",
"enable",
"?",
"helpTextConfig",
".",
"color",
":",
"this",
".",
"_getTextFieldColor",
"(",
")",
";",
"var",
"value",
"=",
"enable",
"?",
"helpText",
":",
"\"\"",
";",
"var",
"helpTextClass",
"=",
"\"x\"",
"+",
"this",
".",
"_skinnableClass",
"+",
"\"_\"",
"+",
"cfg",
".",
"sclass",
"+",
"\"_helpText\"",
";",
"var",
"classNames",
"=",
"field",
".",
"className",
".",
"split",
"(",
"/",
"\\s+",
"/",
")",
";",
"ariaUtilsArray",
".",
"remove",
"(",
"classNames",
",",
"helpTextClass",
")",
";",
"if",
"(",
"enable",
")",
"{",
"classNames",
".",
"push",
"(",
"helpTextClass",
")",
";",
"}",
"field",
".",
"className",
"=",
"classNames",
".",
"join",
"(",
"' '",
")",
";",
"var",
"style",
"=",
"field",
".",
"style",
";",
"style",
".",
"color",
"=",
"color",
";",
"field",
".",
"value",
"=",
"value",
";",
"}"
]
| Set the helptext of the field if needed
@param {Boolean} enable Whether to enable it or not | [
"Set",
"the",
"helptext",
"of",
"the",
"field",
"if",
"needed"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L1194-L1238 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (enable, value, updateState) {
var cfg = this._cfg, prefillText;
// check for disposal
if (!cfg) {
return;
}
var field = this.getTextInputField();
if (enable) {
if (!field || (field.value && !this._helpTextSet && !this._isPrefilled)) {
return;
}
this.setHelpText(false);
if (value == null) {
prefillText = "";
} else {
prefillText = this._getPrefilledText(value);
}
if (cfg.prefillError) {
prefillText = "";
}
if (!prefillText) {
field.value = prefillText;
this._isPrefilled = false;
this.setHelpText(true);
this._updateState();
} else {
this._isPrefilled = true;
// update field value
field.value = prefillText;
}
} else {
this._isPrefilled = false;
}
if (updateState) {
if (!(enable && this._state == "prefill")) {
this._updateState();
}
}
} | javascript | function (enable, value, updateState) {
var cfg = this._cfg, prefillText;
// check for disposal
if (!cfg) {
return;
}
var field = this.getTextInputField();
if (enable) {
if (!field || (field.value && !this._helpTextSet && !this._isPrefilled)) {
return;
}
this.setHelpText(false);
if (value == null) {
prefillText = "";
} else {
prefillText = this._getPrefilledText(value);
}
if (cfg.prefillError) {
prefillText = "";
}
if (!prefillText) {
field.value = prefillText;
this._isPrefilled = false;
this.setHelpText(true);
this._updateState();
} else {
this._isPrefilled = true;
// update field value
field.value = prefillText;
}
} else {
this._isPrefilled = false;
}
if (updateState) {
if (!(enable && this._state == "prefill")) {
this._updateState();
}
}
} | [
"function",
"(",
"enable",
",",
"value",
",",
"updateState",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
",",
"prefillText",
";",
"if",
"(",
"!",
"cfg",
")",
"{",
"return",
";",
"}",
"var",
"field",
"=",
"this",
".",
"getTextInputField",
"(",
")",
";",
"if",
"(",
"enable",
")",
"{",
"if",
"(",
"!",
"field",
"||",
"(",
"field",
".",
"value",
"&&",
"!",
"this",
".",
"_helpTextSet",
"&&",
"!",
"this",
".",
"_isPrefilled",
")",
")",
"{",
"return",
";",
"}",
"this",
".",
"setHelpText",
"(",
"false",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"prefillText",
"=",
"\"\"",
";",
"}",
"else",
"{",
"prefillText",
"=",
"this",
".",
"_getPrefilledText",
"(",
"value",
")",
";",
"}",
"if",
"(",
"cfg",
".",
"prefillError",
")",
"{",
"prefillText",
"=",
"\"\"",
";",
"}",
"if",
"(",
"!",
"prefillText",
")",
"{",
"field",
".",
"value",
"=",
"prefillText",
";",
"this",
".",
"_isPrefilled",
"=",
"false",
";",
"this",
".",
"setHelpText",
"(",
"true",
")",
";",
"this",
".",
"_updateState",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"_isPrefilled",
"=",
"true",
";",
"field",
".",
"value",
"=",
"prefillText",
";",
"}",
"}",
"else",
"{",
"this",
".",
"_isPrefilled",
"=",
"false",
";",
"}",
"if",
"(",
"updateState",
")",
"{",
"if",
"(",
"!",
"(",
"enable",
"&&",
"this",
".",
"_state",
"==",
"\"prefill\"",
")",
")",
"{",
"this",
".",
"_updateState",
"(",
")",
";",
"}",
"}",
"}"
]
| Set the prefill text of the field if needed
@param {Boolean} enable false if you want to leave the prefill state
@param {String|Array} value optional string (or array for the multiselect) to fill the field with
@param {Boolean} updateState if true a state update is triggered at the end | [
"Set",
"the",
"prefill",
"text",
"of",
"the",
"field",
"if",
"needed"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L1246-L1287 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function (idArray, fromSelf) {
if (this._cfg.disabled) {
return false;
}
var textInputField = this.getTextInputField();
textInputField.focus();
// IE FIX: requires the value to be reset for the cursor to be positioned
// and focused at the end of the textinput.value string
if (ariaCoreBrowser.isIE) {
textInputField.value = textInputField.value;
}
} | javascript | function (idArray, fromSelf) {
if (this._cfg.disabled) {
return false;
}
var textInputField = this.getTextInputField();
textInputField.focus();
// IE FIX: requires the value to be reset for the cursor to be positioned
// and focused at the end of the textinput.value string
if (ariaCoreBrowser.isIE) {
textInputField.value = textInputField.value;
}
} | [
"function",
"(",
"idArray",
",",
"fromSelf",
")",
"{",
"if",
"(",
"this",
".",
"_cfg",
".",
"disabled",
")",
"{",
"return",
"false",
";",
"}",
"var",
"textInputField",
"=",
"this",
".",
"getTextInputField",
"(",
")",
";",
"textInputField",
".",
"focus",
"(",
")",
";",
"if",
"(",
"ariaCoreBrowser",
".",
"isIE",
")",
"{",
"textInputField",
".",
"value",
"=",
"textInputField",
".",
"value",
";",
"}",
"}"
]
| Focus this field
@param {Array} idArray Path of ids on which we should give focus. Should be empty
@param {Boolean} fromSelf Whether the focus is coming from the widget itself. In this case we don't try to
autoselect
@return {Boolean} true if focus was possible
@override | [
"Focus",
"this",
"field"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L1297-L1309 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/TextInput.js | function () {
// this._cfg can be null due to the following execution chain: native focus -> native blur -> AutoComplete
// bound value update in the data model -> bindRefreshTo section refresh
if (this._firstFocus && this._cfg && this._cfg.autoselect) {
// this allow to click again and put the cursor at a given position
this._firstFocus = false;
var field = this.getTextInputField();
var start = 0;
var end = (field.value.length) ? field.value.length : 0;
if (end) {
this.setCaretPosition(start, end);
}
}
} | javascript | function () {
// this._cfg can be null due to the following execution chain: native focus -> native blur -> AutoComplete
// bound value update in the data model -> bindRefreshTo section refresh
if (this._firstFocus && this._cfg && this._cfg.autoselect) {
// this allow to click again and put the cursor at a given position
this._firstFocus = false;
var field = this.getTextInputField();
var start = 0;
var end = (field.value.length) ? field.value.length : 0;
if (end) {
this.setCaretPosition(start, end);
}
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_firstFocus",
"&&",
"this",
".",
"_cfg",
"&&",
"this",
".",
"_cfg",
".",
"autoselect",
")",
"{",
"this",
".",
"_firstFocus",
"=",
"false",
";",
"var",
"field",
"=",
"this",
".",
"getTextInputField",
"(",
")",
";",
"var",
"start",
"=",
"0",
";",
"var",
"end",
"=",
"(",
"field",
".",
"value",
".",
"length",
")",
"?",
"field",
".",
"value",
".",
"length",
":",
"0",
";",
"if",
"(",
"end",
")",
"{",
"this",
".",
"setCaretPosition",
"(",
"start",
",",
"end",
")",
";",
"}",
"}",
"}"
]
| If enabled, autoselect the widget text, setting the caret position to the whole input value.
@protected | [
"If",
"enabled",
"autoselect",
"the",
"widget",
"text",
"setting",
"the",
"caret",
"position",
"to",
"the",
"whole",
"input",
"value",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/TextInput.js#L1315-L1328 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassWriter.js | function (processStatement, processErrors) {
/**
* Callback used to process a single statement in the content
* @type aria.core.CfgBeans:Callback
* @protected
*/
this._processStatement = processStatement;
/**
* Callback used to process errors
* @type aria.core.CfgBeans:Callback
* @protected
*/
this._processErrors = processErrors;
/**
* Current indentation string. Used when writing a line
* @type String
* @protected
*/
this._curindent = '';
/**
* Text used for indentation (null to disable)
* @type String
*/
this.indentUnit = ' ';
/**
* Counter for number of variables created. This is increased every time a new var statement is called and is
* used as unique key.
* @type Number
* @protected
*/
this._varNameNumber = 0;
/**
* Optional error context to be passed when logging errors
* @type Object
*/
this.errorContext = null;
/**
* if true, the dependencies section should even contain already loaded dependencies
* @type Boolean
*/
this.allDependencies = null;
/**
* Stores the template parameter
* @type Object
*/
this.templateParam = null;
/**
* Stores the parent class type
* @type String
*/
this.parentClassType = "JS";
/**
* Stores the parent class name
* @type String
*/
this.parentClassName = null;
/**
* Stores the parent classpath
* @type String
*/
this.parentClasspath = null;
/**
* Stores the script class name
* @type String
*/
this.scriptClassName = null;
/**
* Stores the script classpath
* @type String
*/
this.scriptClasspath = null;
/**
* Callback to call when generation is finished
* @type aria.core.CfgBeans:Callback
*/
this.callback = null;
/**
* Direct link to widget libraries
* @type Object
*
* <pre>
* {
* libName : libClasspath
* }
* </pre>
*/
this.wlibs = {};
/**
* Map of declared macros
* @type Object
*
* <pre>
* {
* macroName : {
* definition : statement
* }
* }
* </pre>
*/
this.macros = {};
/**
* Map of declared views
* @type Object
*
* <pre>
* {
* viewName : {
* firstDefinition : statement,
* nbParams : numberOfParameters
* }
* }
* </pre>
*/
this.views = {};
/**
* Current working output block
* @type Object
* @protected
*/
this._curblock = null;
/**
* Map of possible output block
* @type Object
*
* <pre>
* {
* blockName : {
* curindentnbr : indent,
* out : []
* }
* }
* </pre>
*
* @protected
*/
this._blocks = {};
/**
* Stack of output blocks
* @type Array
* @protected
*/
this._stack = [];
/**
* Map of dependencies found for the class to be generated
* @protected
*/
this._dependencies = {};
/**
* Contains information about errors which occured during the generation process. If the processErrors callback
* is provided, the errors property contains a boolean indicating whether errors occurred or not. If the
* processErrors callback is not provided, the errors property is null if no error occured, otherwise, it
* contains the array of errors.
*/
this.errors = processErrors ? false : null;
/**
* Indicates if the writer has a mirror debug writer
* @type Boolean
*/
this.debug = false;
/**
* Tree structure generated by the parser
* @type aria.templates.TreeBeans:Root
*/
this.tree = null;
/**
* If set to true, code generation is disabled, only parsing matters.
* @type Boolean
*/
this.parseOnly = false;
/**
* If set to true, widget libraries will not be loaded during class generation.
* @type Boolean
*/
this.dontLoadWidgetLibs = false;
} | javascript | function (processStatement, processErrors) {
/**
* Callback used to process a single statement in the content
* @type aria.core.CfgBeans:Callback
* @protected
*/
this._processStatement = processStatement;
/**
* Callback used to process errors
* @type aria.core.CfgBeans:Callback
* @protected
*/
this._processErrors = processErrors;
/**
* Current indentation string. Used when writing a line
* @type String
* @protected
*/
this._curindent = '';
/**
* Text used for indentation (null to disable)
* @type String
*/
this.indentUnit = ' ';
/**
* Counter for number of variables created. This is increased every time a new var statement is called and is
* used as unique key.
* @type Number
* @protected
*/
this._varNameNumber = 0;
/**
* Optional error context to be passed when logging errors
* @type Object
*/
this.errorContext = null;
/**
* if true, the dependencies section should even contain already loaded dependencies
* @type Boolean
*/
this.allDependencies = null;
/**
* Stores the template parameter
* @type Object
*/
this.templateParam = null;
/**
* Stores the parent class type
* @type String
*/
this.parentClassType = "JS";
/**
* Stores the parent class name
* @type String
*/
this.parentClassName = null;
/**
* Stores the parent classpath
* @type String
*/
this.parentClasspath = null;
/**
* Stores the script class name
* @type String
*/
this.scriptClassName = null;
/**
* Stores the script classpath
* @type String
*/
this.scriptClasspath = null;
/**
* Callback to call when generation is finished
* @type aria.core.CfgBeans:Callback
*/
this.callback = null;
/**
* Direct link to widget libraries
* @type Object
*
* <pre>
* {
* libName : libClasspath
* }
* </pre>
*/
this.wlibs = {};
/**
* Map of declared macros
* @type Object
*
* <pre>
* {
* macroName : {
* definition : statement
* }
* }
* </pre>
*/
this.macros = {};
/**
* Map of declared views
* @type Object
*
* <pre>
* {
* viewName : {
* firstDefinition : statement,
* nbParams : numberOfParameters
* }
* }
* </pre>
*/
this.views = {};
/**
* Current working output block
* @type Object
* @protected
*/
this._curblock = null;
/**
* Map of possible output block
* @type Object
*
* <pre>
* {
* blockName : {
* curindentnbr : indent,
* out : []
* }
* }
* </pre>
*
* @protected
*/
this._blocks = {};
/**
* Stack of output blocks
* @type Array
* @protected
*/
this._stack = [];
/**
* Map of dependencies found for the class to be generated
* @protected
*/
this._dependencies = {};
/**
* Contains information about errors which occured during the generation process. If the processErrors callback
* is provided, the errors property contains a boolean indicating whether errors occurred or not. If the
* processErrors callback is not provided, the errors property is null if no error occured, otherwise, it
* contains the array of errors.
*/
this.errors = processErrors ? false : null;
/**
* Indicates if the writer has a mirror debug writer
* @type Boolean
*/
this.debug = false;
/**
* Tree structure generated by the parser
* @type aria.templates.TreeBeans:Root
*/
this.tree = null;
/**
* If set to true, code generation is disabled, only parsing matters.
* @type Boolean
*/
this.parseOnly = false;
/**
* If set to true, widget libraries will not be loaded during class generation.
* @type Boolean
*/
this.dontLoadWidgetLibs = false;
} | [
"function",
"(",
"processStatement",
",",
"processErrors",
")",
"{",
"this",
".",
"_processStatement",
"=",
"processStatement",
";",
"this",
".",
"_processErrors",
"=",
"processErrors",
";",
"this",
".",
"_curindent",
"=",
"''",
";",
"this",
".",
"indentUnit",
"=",
"' '",
";",
"this",
".",
"_varNameNumber",
"=",
"0",
";",
"this",
".",
"errorContext",
"=",
"null",
";",
"this",
".",
"allDependencies",
"=",
"null",
";",
"this",
".",
"templateParam",
"=",
"null",
";",
"this",
".",
"parentClassType",
"=",
"\"JS\"",
";",
"this",
".",
"parentClassName",
"=",
"null",
";",
"this",
".",
"parentClasspath",
"=",
"null",
";",
"this",
".",
"scriptClassName",
"=",
"null",
";",
"this",
".",
"scriptClasspath",
"=",
"null",
";",
"this",
".",
"callback",
"=",
"null",
";",
"this",
".",
"wlibs",
"=",
"{",
"}",
";",
"this",
".",
"macros",
"=",
"{",
"}",
";",
"this",
".",
"views",
"=",
"{",
"}",
";",
"this",
".",
"_curblock",
"=",
"null",
";",
"this",
".",
"_blocks",
"=",
"{",
"}",
";",
"this",
".",
"_stack",
"=",
"[",
"]",
";",
"this",
".",
"_dependencies",
"=",
"{",
"}",
";",
"this",
".",
"errors",
"=",
"processErrors",
"?",
"false",
":",
"null",
";",
"this",
".",
"debug",
"=",
"false",
";",
"this",
".",
"tree",
"=",
"null",
";",
"this",
".",
"parseOnly",
"=",
"false",
";",
"this",
".",
"dontLoadWidgetLibs",
"=",
"false",
";",
"}"
]
| Create a Class Writer instance
@param {aria.core.CfgBeans:Callback} processStatement Callback used to process a single statement in the content
@param {aria.core.CfgBeans:Callback} processErrors Callback used to process errors. Can be omitted for default
error processing (appending errors to the errors array) | [
"Create",
"a",
"Class",
"Writer",
"instance"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassWriter.js#L29-L228 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassWriter.js | function (dependencies, extension) {
if (dependencies) {
for (var i = dependencies.length - 1; i >= 0; i--) {
this.addDependency(dependencies[i], extension);
}
}
} | javascript | function (dependencies, extension) {
if (dependencies) {
for (var i = dependencies.length - 1; i >= 0; i--) {
this.addDependency(dependencies[i], extension);
}
}
} | [
"function",
"(",
"dependencies",
",",
"extension",
")",
"{",
"if",
"(",
"dependencies",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"dependencies",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"this",
".",
"addDependency",
"(",
"dependencies",
"[",
"i",
"]",
",",
"extension",
")",
";",
"}",
"}",
"}"
]
| Add a list of classpath dependencies
@param {Array} dependencies list of classpath
@param {String} extension dependencies extension (default: ".js") | [
"Add",
"a",
"list",
"of",
"classpath",
"dependencies"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassWriter.js#L235-L241 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassWriter.js | function (macroName) {
var res = this.macros[macroName];
if (res == null) {
res = {};
this.macros[macroName] = res;
}
return res;
} | javascript | function (macroName) {
var res = this.macros[macroName];
if (res == null) {
res = {};
this.macros[macroName] = res;
}
return res;
} | [
"function",
"(",
"macroName",
")",
"{",
"var",
"res",
"=",
"this",
".",
"macros",
"[",
"macroName",
"]",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"res",
"=",
"{",
"}",
";",
"this",
".",
"macros",
"[",
"macroName",
"]",
"=",
"res",
";",
"}",
"return",
"res",
";",
"}"
]
| Get a macro description
@param {String} macroName Name of the macro
@return {Object} | [
"Get",
"a",
"macro",
"description"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassWriter.js#L269-L276 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassWriter.js | function (viewBaseName) {
var res = this.views[viewBaseName];
if (res == null) {
res = {
baseName: viewBaseName
};
this.views[viewBaseName] = res;
}
return res;
} | javascript | function (viewBaseName) {
var res = this.views[viewBaseName];
if (res == null) {
res = {
baseName: viewBaseName
};
this.views[viewBaseName] = res;
}
return res;
} | [
"function",
"(",
"viewBaseName",
")",
"{",
"var",
"res",
"=",
"this",
".",
"views",
"[",
"viewBaseName",
"]",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"res",
"=",
"{",
"baseName",
":",
"viewBaseName",
"}",
";",
"this",
".",
"views",
"[",
"viewBaseName",
"]",
"=",
"res",
";",
"}",
"return",
"res",
";",
"}"
]
| Get a view description
@param {String} viewBaseName Name of the view
@return {Object} | [
"Get",
"a",
"view",
"description"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassWriter.js#L283-L292 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassWriter.js | function (statement, msgId, msgArgs) {
if (this._processErrors) {
this.errors = true;
this._processErrors.fn.call(this._processErrors.scope, statement, msgId, msgArgs, this.errorContext);
} else {
if (!msgArgs) {
msgArgs = [];
}
if (!this.errors) {
this.errors = this.logErrors ? true : [];
}
msgArgs.push(statement.lineNumber);
this.errors.push({
msgId : msgId,
msgArgs : msgArgs,
errorContext : this.errorContext
});
}
} | javascript | function (statement, msgId, msgArgs) {
if (this._processErrors) {
this.errors = true;
this._processErrors.fn.call(this._processErrors.scope, statement, msgId, msgArgs, this.errorContext);
} else {
if (!msgArgs) {
msgArgs = [];
}
if (!this.errors) {
this.errors = this.logErrors ? true : [];
}
msgArgs.push(statement.lineNumber);
this.errors.push({
msgId : msgId,
msgArgs : msgArgs,
errorContext : this.errorContext
});
}
} | [
"function",
"(",
"statement",
",",
"msgId",
",",
"msgArgs",
")",
"{",
"if",
"(",
"this",
".",
"_processErrors",
")",
"{",
"this",
".",
"errors",
"=",
"true",
";",
"this",
".",
"_processErrors",
".",
"fn",
".",
"call",
"(",
"this",
".",
"_processErrors",
".",
"scope",
",",
"statement",
",",
"msgId",
",",
"msgArgs",
",",
"this",
".",
"errorContext",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"msgArgs",
")",
"{",
"msgArgs",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"this",
".",
"errors",
")",
"{",
"this",
".",
"errors",
"=",
"this",
".",
"logErrors",
"?",
"true",
":",
"[",
"]",
";",
"}",
"msgArgs",
".",
"push",
"(",
"statement",
".",
"lineNumber",
")",
";",
"this",
".",
"errors",
".",
"push",
"(",
"{",
"msgId",
":",
"msgId",
",",
"msgArgs",
":",
"msgArgs",
",",
"errorContext",
":",
"this",
".",
"errorContext",
"}",
")",
";",
"}",
"}"
]
| Log an error calling the error callback defined in the constructor.
@param {aria.templates.TreeBeans:Statement} statement Statement generating the error
@param {String} msgId Message to be logged
@param {Array} msgArgs List of error parameters as in jsObject.$logError | [
"Log",
"an",
"error",
"calling",
"the",
"error",
"callback",
"defined",
"in",
"the",
"constructor",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassWriter.js#L395-L414 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassWriter.js | function () {
var out = this._curblock.out;
if (this._curindent) {
out.push(this._curindent);
}
out.push.apply(out, arguments);
out.push('\n');
} | javascript | function () {
var out = this._curblock.out;
if (this._curindent) {
out.push(this._curindent);
}
out.push.apply(out, arguments);
out.push('\n');
} | [
"function",
"(",
")",
"{",
"var",
"out",
"=",
"this",
".",
"_curblock",
".",
"out",
";",
"if",
"(",
"this",
".",
"_curindent",
")",
"{",
"out",
".",
"push",
"(",
"this",
".",
"_curindent",
")",
";",
"}",
"out",
".",
"push",
".",
"apply",
"(",
"out",
",",
"arguments",
")",
";",
"out",
".",
"push",
"(",
"'\\n'",
")",
";",
"}"
]
| Write a line in the current output block. The line is built concatenating all arguments and appending a new
line character.
@param {String} One or more string to be written | [
"Write",
"a",
"line",
"in",
"the",
"current",
"output",
"block",
".",
"The",
"line",
"is",
"built",
"concatenating",
"all",
"arguments",
"and",
"appending",
"a",
"new",
"line",
"character",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassWriter.js#L455-L462 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassWriter.js | function (exprStr, statement, errorMsg) {
var container = this.newVarName();
// stringify the expression for the eval
exprStr = this.stringify(exprStr);
this.writeln("var " + container + " = null;");
this.writeln("try {");
this.increaseIndent();
// remove quotes
exprStr = exprStr.substr(1, exprStr.length - 2);
this.writeln('eval( "' + container + '=(' + exprStr + ')" );');
this.decreaseIndent();
this.writeln("} catch (e) {");
this.increaseIndent();
this.writeln("this.$logError(", errorMsg, ",[\"", exprStr, "\",__filename,", statement.lineNumber, ",", this.stringify(statement.name), "], e);");
this.decreaseIndent();
this.writeln("}");
return container;
} | javascript | function (exprStr, statement, errorMsg) {
var container = this.newVarName();
// stringify the expression for the eval
exprStr = this.stringify(exprStr);
this.writeln("var " + container + " = null;");
this.writeln("try {");
this.increaseIndent();
// remove quotes
exprStr = exprStr.substr(1, exprStr.length - 2);
this.writeln('eval( "' + container + '=(' + exprStr + ')" );');
this.decreaseIndent();
this.writeln("} catch (e) {");
this.increaseIndent();
this.writeln("this.$logError(", errorMsg, ",[\"", exprStr, "\",__filename,", statement.lineNumber, ",", this.stringify(statement.name), "], e);");
this.decreaseIndent();
this.writeln("}");
return container;
} | [
"function",
"(",
"exprStr",
",",
"statement",
",",
"errorMsg",
")",
"{",
"var",
"container",
"=",
"this",
".",
"newVarName",
"(",
")",
";",
"exprStr",
"=",
"this",
".",
"stringify",
"(",
"exprStr",
")",
";",
"this",
".",
"writeln",
"(",
"\"var \"",
"+",
"container",
"+",
"\" = null;\"",
")",
";",
"this",
".",
"writeln",
"(",
"\"try {\"",
")",
";",
"this",
".",
"increaseIndent",
"(",
")",
";",
"exprStr",
"=",
"exprStr",
".",
"substr",
"(",
"1",
",",
"exprStr",
".",
"length",
"-",
"2",
")",
";",
"this",
".",
"writeln",
"(",
"'eval( \"'",
"+",
"container",
"+",
"'=('",
"+",
"exprStr",
"+",
"')\" );'",
")",
";",
"this",
".",
"decreaseIndent",
"(",
")",
";",
"this",
".",
"writeln",
"(",
"\"} catch (e) {\"",
")",
";",
"this",
".",
"increaseIndent",
"(",
")",
";",
"this",
".",
"writeln",
"(",
"\"this.$logError(\"",
",",
"errorMsg",
",",
"\",[\\\"\"",
",",
"\\\"",
",",
"exprStr",
",",
"\"\\\",__filename,\"",
",",
"\\\"",
",",
"statement",
".",
"lineNumber",
",",
"\",\"",
")",
";",
"this",
".",
"stringify",
"(",
"statement",
".",
"name",
")",
"\"], e);\"",
"this",
".",
"decreaseIndent",
"(",
")",
";",
"}"
]
| Wrap an expression evaluation in a try catch and return result
@param {String} exprStr String to be eval'ed
@param {aria.templates.TreeBeans:Statement} statement Statement corresponding to the expression
@param {String} errorMsg Message to be logged in case of errors
@return {String} container the name of the variable that will contain the expression | [
"Wrap",
"an",
"expression",
"evaluation",
"in",
"a",
"try",
"catch",
"and",
"return",
"result"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassWriter.js#L480-L500 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassWriter.js | function () {
this.parseOnly = true;
// disables functions which are only useful to generate code:
var empty = Aria.empty;
this.writeDependencies = empty;
this.newVarName = empty;
this.writeln = empty;
this.write = empty;
this.wrapExpression = empty;
this.trackLine = empty;
} | javascript | function () {
this.parseOnly = true;
// disables functions which are only useful to generate code:
var empty = Aria.empty;
this.writeDependencies = empty;
this.newVarName = empty;
this.writeln = empty;
this.write = empty;
this.wrapExpression = empty;
this.trackLine = empty;
} | [
"function",
"(",
")",
"{",
"this",
".",
"parseOnly",
"=",
"true",
";",
"var",
"empty",
"=",
"Aria",
".",
"empty",
";",
"this",
".",
"writeDependencies",
"=",
"empty",
";",
"this",
".",
"newVarName",
"=",
"empty",
";",
"this",
".",
"writeln",
"=",
"empty",
";",
"this",
".",
"write",
"=",
"empty",
";",
"this",
".",
"wrapExpression",
"=",
"empty",
";",
"this",
".",
"trackLine",
"=",
"empty",
";",
"}"
]
| Set the parseOnly flag to true and disables functions which are only useful for class generation. | [
"Set",
"the",
"parseOnly",
"flag",
"to",
"true",
"and",
"disables",
"functions",
"which",
"are",
"only",
"useful",
"for",
"class",
"generation",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassWriter.js#L515-L525 | train |
|
ariatemplates/ariatemplates | src/aria/utils/String.js | function (string) {
var params = Array.prototype.slice.call(arguments, 1);
params = ariaUtilsArray.flattenDeep(params);
string = string.replace(/%[0-9]+/g, function (token) {
var replacement = params[parseInt(token.substring(1), 10) - 1];
return typeof replacement !== "undefined" ? replacement : token;
});
return string;
} | javascript | function (string) {
var params = Array.prototype.slice.call(arguments, 1);
params = ariaUtilsArray.flattenDeep(params);
string = string.replace(/%[0-9]+/g, function (token) {
var replacement = params[parseInt(token.substring(1), 10) - 1];
return typeof replacement !== "undefined" ? replacement : token;
});
return string;
} | [
"function",
"(",
"string",
")",
"{",
"var",
"params",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"params",
"=",
"ariaUtilsArray",
".",
"flattenDeep",
"(",
"params",
")",
";",
"string",
"=",
"string",
".",
"replace",
"(",
"/",
"%[0-9]+",
"/",
"g",
",",
"function",
"(",
"token",
")",
"{",
"var",
"replacement",
"=",
"params",
"[",
"parseInt",
"(",
"token",
".",
"substring",
"(",
"1",
")",
",",
"10",
")",
"-",
"1",
"]",
";",
"return",
"typeof",
"replacement",
"!==",
"\"undefined\"",
"?",
"replacement",
":",
"token",
";",
"}",
")",
";",
"return",
"string",
";",
"}"
]
| Substitute %n parameters in a string
@param {String} string The source string to substitute %n occurrences in
@param {Array|String} ...params All the remaining parameters, that can form from one simple string to deeply nested arrays of strings, will be resolved to a single list of strings. These strings will be used for the substitutions. Index 0 will replace %1, index 1, %2 and so on.
@return {String} The final string, with %n occurrences replaced with their equivalent | [
"Substitute",
"%n",
"parameters",
"in",
"a",
"string"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/String.js#L33-L43 | train |
|
ariatemplates/ariatemplates | src/aria/utils/String.js | function (str, index) {
var res = false;
for (var i = index - 1; i >= 0; i--) {
if (str.charAt(i) == "\\") {
res = !res;
} else {
return res;
}
}
return res;
} | javascript | function (str, index) {
var res = false;
for (var i = index - 1; i >= 0; i--) {
if (str.charAt(i) == "\\") {
res = !res;
} else {
return res;
}
}
return res;
} | [
"function",
"(",
"str",
",",
"index",
")",
"{",
"var",
"res",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"index",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"str",
".",
"charAt",
"(",
"i",
")",
"==",
"\"\\\\\"",
")",
"\\\\",
"else",
"{",
"res",
"=",
"!",
"res",
";",
"}",
"}",
"{",
"return",
"res",
";",
"}",
"}"
]
| Return true if the character at index in str is escaped with backslashes.
@param {String} str
@param {Integer} index
@return {Boolean} true if the character is escaped, false otherwise | [
"Return",
"true",
"if",
"the",
"character",
"at",
"index",
"in",
"str",
"is",
"escaped",
"with",
"backslashes",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/String.js#L60-L70 | train |
|
ariatemplates/ariatemplates | src/aria/utils/String.js | function (str, findChar, start) {
var index = str.indexOf(findChar, start);
while (index != -1) {
if (!this.isEscaped(str, index)) {
return index;
}
// continue search after escaped character
index = str.indexOf(findChar, index + 1);
}
return -1;
} | javascript | function (str, findChar, start) {
var index = str.indexOf(findChar, start);
while (index != -1) {
if (!this.isEscaped(str, index)) {
return index;
}
// continue search after escaped character
index = str.indexOf(findChar, index + 1);
}
return -1;
} | [
"function",
"(",
"str",
",",
"findChar",
",",
"start",
")",
"{",
"var",
"index",
"=",
"str",
".",
"indexOf",
"(",
"findChar",
",",
"start",
")",
";",
"while",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isEscaped",
"(",
"str",
",",
"index",
")",
")",
"{",
"return",
"index",
";",
"}",
"index",
"=",
"str",
".",
"indexOf",
"(",
"findChar",
",",
"index",
"+",
"1",
")",
";",
"}",
"return",
"-",
"1",
";",
"}"
]
| Find the next not escaped character findChar, after start in str.
@param {String} str
@param {String} findChar character to find in str
@param {Integer} start position in str (default value: 0) | [
"Find",
"the",
"next",
"not",
"escaped",
"character",
"findChar",
"after",
"start",
"in",
"str",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/String.js#L78-L88 | train |
|
ariatemplates/ariatemplates | src/aria/utils/String.js | function (str, options, infos) {
// -------------------------------------- input arguments processing
// options ---------------------------------------------------------
if (options == null) {
options = true;
}
if (!ariaUtilsType.isObject(options)) {
options = !!options;
options = {
text: options,
attr: options
};
}
var escapeForHTMLText = !!(options.text);
var escapeForHTMLAttr = !!(options.attr);
// ------------------------------------------------------ processing
var escaped = false;
var textEscaped = false;
var attrEscaped = false;
if (escapeForHTMLText) {
escaped = true;
textEscaped = true;
str = this.escapeHTML(str).replace(/\//g, "/");
}
if (escapeForHTMLAttr) {
escaped = true;
attrEscaped = true;
str = this.escapeHTMLAttr(str);
}
// ---------------------------------------------------------- return
if (infos != null) {
infos.escaped = escaped;
infos.text = textEscaped;
infos.attr = attrEscaped;
}
return str;
} | javascript | function (str, options, infos) {
// -------------------------------------- input arguments processing
// options ---------------------------------------------------------
if (options == null) {
options = true;
}
if (!ariaUtilsType.isObject(options)) {
options = !!options;
options = {
text: options,
attr: options
};
}
var escapeForHTMLText = !!(options.text);
var escapeForHTMLAttr = !!(options.attr);
// ------------------------------------------------------ processing
var escaped = false;
var textEscaped = false;
var attrEscaped = false;
if (escapeForHTMLText) {
escaped = true;
textEscaped = true;
str = this.escapeHTML(str).replace(/\//g, "/");
}
if (escapeForHTMLAttr) {
escaped = true;
attrEscaped = true;
str = this.escapeHTMLAttr(str);
}
// ---------------------------------------------------------- return
if (infos != null) {
infos.escaped = escaped;
infos.text = textEscaped;
infos.attr = attrEscaped;
}
return str;
} | [
"function",
"(",
"str",
",",
"options",
",",
"infos",
")",
"{",
"if",
"(",
"options",
"==",
"null",
")",
"{",
"options",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"ariaUtilsType",
".",
"isObject",
"(",
"options",
")",
")",
"{",
"options",
"=",
"!",
"!",
"options",
";",
"options",
"=",
"{",
"text",
":",
"options",
",",
"attr",
":",
"options",
"}",
";",
"}",
"var",
"escapeForHTMLText",
"=",
"!",
"!",
"(",
"options",
".",
"text",
")",
";",
"var",
"escapeForHTMLAttr",
"=",
"!",
"!",
"(",
"options",
".",
"attr",
")",
";",
"var",
"escaped",
"=",
"false",
";",
"var",
"textEscaped",
"=",
"false",
";",
"var",
"attrEscaped",
"=",
"false",
";",
"if",
"(",
"escapeForHTMLText",
")",
"{",
"escaped",
"=",
"true",
";",
"textEscaped",
"=",
"true",
";",
"str",
"=",
"this",
".",
"escapeHTML",
"(",
"str",
")",
".",
"replace",
"(",
"/",
"\\/",
"/",
"g",
",",
"\"/\"",
")",
";",
"}",
"if",
"(",
"escapeForHTMLAttr",
")",
"{",
"escaped",
"=",
"true",
";",
"attrEscaped",
"=",
"true",
";",
"str",
"=",
"this",
".",
"escapeHTMLAttr",
"(",
"str",
")",
";",
"}",
"if",
"(",
"infos",
"!=",
"null",
")",
"{",
"infos",
".",
"escaped",
"=",
"escaped",
";",
"infos",
".",
"text",
"=",
"textEscaped",
";",
"infos",
".",
"attr",
"=",
"attrEscaped",
";",
"}",
"return",
"str",
";",
"}"
]
| Escape the given string depending on the options. When no options is passed, the escaping is applied for all contexts.
The string can be escaped for different contexts:
<ul>
<li>safe insertion inside an HTML text node</li>
<li>safe insertion inside an attribute value</li>
</ul>
@param {String} str Input string
@param options In its more comprehensive form, it is an object in which each property correspond to a context that can be set to a truthy value to activate escaping (a falsy value, thus including null and undefined, will disable it).
<pre>
{
attr: true, // will escape the string for safe insertion inside the value of an attribute
text: false // will NOT escape the string for safe insertion inside an HTML text node
}
</pre>
There are however two shortcuts that can be used:
<ul>
<li>if nothing is passed, it is equivalent to passing true for all contexts</li>
<li>if something is passed but it's not an object, the value is converted to a boolean (with standard JavaScript coercion), and this boolean value will be used for all contexts.</li>
</ul>
@param {Object} infos An optional object for additional infos on what has been done. For now, tells if it has actually been escaped or not, and for which contexts.
@return {String} processed string | [
"Escape",
"the",
"given",
"string",
"depending",
"on",
"the",
"options",
".",
"When",
"no",
"options",
"is",
"passed",
"the",
"escaping",
"is",
"applied",
"for",
"all",
"contexts",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/String.js#L139-L186 | train |
|
ariatemplates/ariatemplates | src/aria/utils/String.js | function (str, start, end, regexp) {
var currentCharPos = start, whiteRegexp = regexp || /\s/, currentChar;
while (currentCharPos < end) {
currentChar = str.charAt(currentCharPos);
if (whiteRegexp.test(currentChar)) {
return currentCharPos;
}
currentCharPos++;
}
return -1;
} | javascript | function (str, start, end, regexp) {
var currentCharPos = start, whiteRegexp = regexp || /\s/, currentChar;
while (currentCharPos < end) {
currentChar = str.charAt(currentCharPos);
if (whiteRegexp.test(currentChar)) {
return currentCharPos;
}
currentCharPos++;
}
return -1;
} | [
"function",
"(",
"str",
",",
"start",
",",
"end",
",",
"regexp",
")",
"{",
"var",
"currentCharPos",
"=",
"start",
",",
"whiteRegexp",
"=",
"regexp",
"||",
"/",
"\\s",
"/",
",",
"currentChar",
";",
"while",
"(",
"currentCharPos",
"<",
"end",
")",
"{",
"currentChar",
"=",
"str",
".",
"charAt",
"(",
"currentCharPos",
")",
";",
"if",
"(",
"whiteRegexp",
".",
"test",
"(",
"currentChar",
")",
")",
"{",
"return",
"currentCharPos",
";",
"}",
"currentCharPos",
"++",
";",
"}",
"return",
"-",
"1",
";",
"}"
]
| Find next white space in the given string after start position and before end position
@param {String} str The string into which we search
@param {Integer} start The position in str at which we should begin the search (included)
@param {Integer} end The position in str at which we should end the search (excluded)
@param {RegExp} regexp The regular expression used to recognize a white space. If not provided, /\s/ is used.
@return {Integer} the position of the whitespace in str (between start and end), or -1 if it was not found | [
"Find",
"next",
"white",
"space",
"in",
"the",
"given",
"string",
"after",
"start",
"position",
"and",
"before",
"end",
"position"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/String.js#L211-L221 | train |
|
ariatemplates/ariatemplates | src/aria/utils/String.js | function (string, size, character, begin) {
string = "" + string;
var length = string.length;
if (length < size) {
var padding = [];
for (var difference = size - length; difference > 0; difference -= 1) {
padding.push(character);
}
if (begin === true) {
string = padding.join("") + string;
} else {
string = string + padding.join("");
}
}
return string;
} | javascript | function (string, size, character, begin) {
string = "" + string;
var length = string.length;
if (length < size) {
var padding = [];
for (var difference = size - length; difference > 0; difference -= 1) {
padding.push(character);
}
if (begin === true) {
string = padding.join("") + string;
} else {
string = string + padding.join("");
}
}
return string;
} | [
"function",
"(",
"string",
",",
"size",
",",
"character",
",",
"begin",
")",
"{",
"string",
"=",
"\"\"",
"+",
"string",
";",
"var",
"length",
"=",
"string",
".",
"length",
";",
"if",
"(",
"length",
"<",
"size",
")",
"{",
"var",
"padding",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"difference",
"=",
"size",
"-",
"length",
";",
"difference",
">",
"0",
";",
"difference",
"-=",
"1",
")",
"{",
"padding",
".",
"push",
"(",
"character",
")",
";",
"}",
"if",
"(",
"begin",
"===",
"true",
")",
"{",
"string",
"=",
"padding",
".",
"join",
"(",
"\"\"",
")",
"+",
"string",
";",
"}",
"else",
"{",
"string",
"=",
"string",
"+",
"padding",
".",
"join",
"(",
"\"\"",
")",
";",
"}",
"}",
"return",
"string",
";",
"}"
]
| Add some padding to a string in order to have a minimu length. If the minimum length is smaller than the
string length, nothing is done.
@param {String} string The string that requires padding
@param {Number} size Minimum length
@param {String} character Character to add.
@param {Boolean} begin Add character at the beginning or at the end of the string. If true at the beginning.
Default false.
@return {String} Padded string | [
"Add",
"some",
"padding",
"to",
"a",
"string",
"in",
"order",
"to",
"have",
"a",
"minimu",
"length",
".",
"If",
"the",
"minimum",
"length",
"is",
"smaller",
"than",
"the",
"string",
"length",
"nothing",
"is",
"done",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/String.js#L271-L287 | train |
|
ariatemplates/ariatemplates | src/aria/utils/String.js | function (string, size, character, begin) {
var start, length;
if (begin === true) {
for (start = 0, length = string.length - size; start < length; start += 1) {
if (string.charAt(start) !== character) {
break;
}
}
return string.substring(start);
} else {
for (start = string.length - 1; start >= size; start -= 1) {
if (string.charAt(start) !== character) {
break;
}
}
return string.substring(0, start + 1);
}
} | javascript | function (string, size, character, begin) {
var start, length;
if (begin === true) {
for (start = 0, length = string.length - size; start < length; start += 1) {
if (string.charAt(start) !== character) {
break;
}
}
return string.substring(start);
} else {
for (start = string.length - 1; start >= size; start -= 1) {
if (string.charAt(start) !== character) {
break;
}
}
return string.substring(0, start + 1);
}
} | [
"function",
"(",
"string",
",",
"size",
",",
"character",
",",
"begin",
")",
"{",
"var",
"start",
",",
"length",
";",
"if",
"(",
"begin",
"===",
"true",
")",
"{",
"for",
"(",
"start",
"=",
"0",
",",
"length",
"=",
"string",
".",
"length",
"-",
"size",
";",
"start",
"<",
"length",
";",
"start",
"+=",
"1",
")",
"{",
"if",
"(",
"string",
".",
"charAt",
"(",
"start",
")",
"!==",
"character",
")",
"{",
"break",
";",
"}",
"}",
"return",
"string",
".",
"substring",
"(",
"start",
")",
";",
"}",
"else",
"{",
"for",
"(",
"start",
"=",
"string",
".",
"length",
"-",
"1",
";",
"start",
">=",
"size",
";",
"start",
"-=",
"1",
")",
"{",
"if",
"(",
"string",
".",
"charAt",
"(",
"start",
")",
"!==",
"character",
")",
"{",
"break",
";",
"}",
"}",
"return",
"string",
".",
"substring",
"(",
"0",
",",
"start",
"+",
"1",
")",
";",
"}",
"}"
]
| Remove all consecutive occurrences of a character from the beginning or end of a string. It's like trim but
instead of removing white spaces removes the specified character. Unlike trim it works on one direction only.
@param {String} string String to be cropped
@param {Number} size Minimum size of the resulting string
@param {String} character Character to be removed
@param {Boolean} begin Crop from the beginning or the end of the string. If true crops from the beginning.
Default false. | [
"Remove",
"all",
"consecutive",
"occurrences",
"of",
"a",
"character",
"from",
"the",
"beginning",
"or",
"end",
"of",
"a",
"string",
".",
"It",
"s",
"like",
"trim",
"but",
"instead",
"of",
"removing",
"white",
"spaces",
"removes",
"the",
"specified",
"character",
".",
"Unlike",
"trim",
"it",
"works",
"on",
"one",
"direction",
"only",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/String.js#L298-L317 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Number.js | function (number, patternString, formatSymbols) {
formatSymbols = this._normalizeSymbols(formatSymbols);
var patternDescription = this._explode(patternString);
if (!patternDescription) {
return this.$logError(this.INVALID_FORMAT, ["formatCurrency", this.CURRENCY_BEAN]);
}
var currencySymbol = this._currency;
number = this.formatNumber(number, patternString, formatSymbols);
if (patternDescription.currencyBegin) {
return currencySymbol + number;
} else if (patternDescription.currencyEnd) {
return number + currencySymbol;
} else {
return number;
}
} | javascript | function (number, patternString, formatSymbols) {
formatSymbols = this._normalizeSymbols(formatSymbols);
var patternDescription = this._explode(patternString);
if (!patternDescription) {
return this.$logError(this.INVALID_FORMAT, ["formatCurrency", this.CURRENCY_BEAN]);
}
var currencySymbol = this._currency;
number = this.formatNumber(number, patternString, formatSymbols);
if (patternDescription.currencyBegin) {
return currencySymbol + number;
} else if (patternDescription.currencyEnd) {
return number + currencySymbol;
} else {
return number;
}
} | [
"function",
"(",
"number",
",",
"patternString",
",",
"formatSymbols",
")",
"{",
"formatSymbols",
"=",
"this",
".",
"_normalizeSymbols",
"(",
"formatSymbols",
")",
";",
"var",
"patternDescription",
"=",
"this",
".",
"_explode",
"(",
"patternString",
")",
";",
"if",
"(",
"!",
"patternDescription",
")",
"{",
"return",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_FORMAT",
",",
"[",
"\"formatCurrency\"",
",",
"this",
".",
"CURRENCY_BEAN",
"]",
")",
";",
"}",
"var",
"currencySymbol",
"=",
"this",
".",
"_currency",
";",
"number",
"=",
"this",
".",
"formatNumber",
"(",
"number",
",",
"patternString",
",",
"formatSymbols",
")",
";",
"if",
"(",
"patternDescription",
".",
"currencyBegin",
")",
"{",
"return",
"currencySymbol",
"+",
"number",
";",
"}",
"else",
"if",
"(",
"patternDescription",
".",
"currencyEnd",
")",
"{",
"return",
"number",
"+",
"currencySymbol",
";",
"}",
"else",
"{",
"return",
"number",
";",
"}",
"}"
]
| Take the formatted number from formatNumber and apply currency specific formatting, such as the currency
symbol
@param {Number} number The number you want to format
@param {String} patternString the pattern to be used
@param {aria.utils.environment.NumberCfgBeans:DecimalFormatSymbols} formatSymbols Optional custom formatting
symbols
@return {String} | [
"Take",
"the",
"formatted",
"number",
"from",
"formatNumber",
"and",
"apply",
"currency",
"specific",
"formatting",
"such",
"as",
"the",
"currency",
"symbol"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Number.js#L338-L356 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.