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/DomEvent.js | function (evt) {
if (evt && evt._ariaDomEvent) {
evt._wrapperNumber++;
return evt;
} else {
return new aria.DomEvent(evt);
}
} | javascript | function (evt) {
if (evt && evt._ariaDomEvent) {
evt._wrapperNumber++;
return evt;
} else {
return new aria.DomEvent(evt);
}
} | [
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
"&&",
"evt",
".",
"_ariaDomEvent",
")",
"{",
"evt",
".",
"_wrapperNumber",
"++",
";",
"return",
"evt",
";",
"}",
"else",
"{",
"return",
"new",
"aria",
".",
"DomEvent",
"(",
"evt",
")",
";",
"}",
"}"
]
| Return a wrapper on the event passed as a parameter. The parameter can either be already a wrapper, in
which case the parameter is returned without other object creation, or an event from the dom, in which
case a wrapper is created.
<pre>
Instead of using the following code:
_dom_onmouseover : function (evt) {
this.$Widget._dom_onmouseover.call(this,evt);
var domEvt = new aria.DomEvent(evt);
...
domEvt.$dispose();
}
The following code should be used, so that only one DomEvt object is created per event,
event when calling the parent method:
_dom_onmouseover : function (evt) {
var domEvt = aria.DomEvent.getWrapper(evt);
this.$Widget._dom_onmouseover.call(this,domEvt);
...
domEvt.disposeWrapper();
}
</pre>
@param {DOMEvent|aria.DomEvent} evt The event from the dom or a wrapper on it.
@return {aria.DomEvent} domEvt An aria.domEvent object representing the event. | [
"Return",
"a",
"wrapper",
"on",
"the",
"event",
"passed",
"as",
"a",
"parameter",
".",
"The",
"parameter",
"can",
"either",
"be",
"already",
"a",
"wrapper",
"in",
"which",
"case",
"the",
"parameter",
"is",
"returned",
"without",
"other",
"object",
"creation",
"or",
"an",
"event",
"from",
"the",
"dom",
"in",
"which",
"case",
"a",
"wrapper",
"is",
"created",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/DomEvent.js#L322-L329 | train |
|
ariatemplates/ariatemplates | src/aria/DomEvent.js | function (kc, specials) {
// changed for PTR04462051 as spaces were included and this was breaking the AutoComplete widget.
if (kc > 32 && kc < 41) {
return true; // space, page or arrow
}
if (kc == 8 || kc == 9 || kc == 13 || kc == 27) {
return true; // special escape or control keys
}
// changed for PTR04462051 as hyphens were included and this was breaking the AutoComplete widget.
if (kc == 45 || kc == 46) {
return false; // insert or delete
}
/*
* not a special key, just / * - + if (kc == 106 || kc == 107 || kc == 109 || kc == 111) { return true; }
*/
// If we are holding a special key (ctrl, alt, ...) and typing any other key, it's a special key
if (specials.ctrlKey && kc != this.KC_CTRL) {
return true;
}
if (specials.altKey && kc != this.KC_ALT) {
return true;
}
if (kc >= 112 && kc <= 123) {
// F1 .. F12
return true;
}
return false;
} | javascript | function (kc, specials) {
// changed for PTR04462051 as spaces were included and this was breaking the AutoComplete widget.
if (kc > 32 && kc < 41) {
return true; // space, page or arrow
}
if (kc == 8 || kc == 9 || kc == 13 || kc == 27) {
return true; // special escape or control keys
}
// changed for PTR04462051 as hyphens were included and this was breaking the AutoComplete widget.
if (kc == 45 || kc == 46) {
return false; // insert or delete
}
/*
* not a special key, just / * - + if (kc == 106 || kc == 107 || kc == 109 || kc == 111) { return true; }
*/
// If we are holding a special key (ctrl, alt, ...) and typing any other key, it's a special key
if (specials.ctrlKey && kc != this.KC_CTRL) {
return true;
}
if (specials.altKey && kc != this.KC_ALT) {
return true;
}
if (kc >= 112 && kc <= 123) {
// F1 .. F12
return true;
}
return false;
} | [
"function",
"(",
"kc",
",",
"specials",
")",
"{",
"if",
"(",
"kc",
">",
"32",
"&&",
"kc",
"<",
"41",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"kc",
"==",
"8",
"||",
"kc",
"==",
"9",
"||",
"kc",
"==",
"13",
"||",
"kc",
"==",
"27",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"kc",
"==",
"45",
"||",
"kc",
"==",
"46",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"specials",
".",
"ctrlKey",
"&&",
"kc",
"!=",
"this",
".",
"KC_CTRL",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"specials",
".",
"altKey",
"&&",
"kc",
"!=",
"this",
".",
"KC_ALT",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"kc",
">=",
"112",
"&&",
"kc",
"<=",
"123",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
]
| Static method indicating if a key code corresponds to a special key generally used to navigate or control
the user input
@param {Number} kc the key code (cf. onkeyup/onkeydown)
@param {Object} specials Object that tells if ctrlKey and altKey are pressed
@return {Boolean} true if kc corresponds to a special key | [
"Static",
"method",
"indicating",
"if",
"a",
"key",
"code",
"corresponds",
"to",
"a",
"special",
"key",
"generally",
"used",
"to",
"navigate",
"or",
"control",
"the",
"user",
"input"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/DomEvent.js#L438-L466 | train |
|
ariatemplates/ariatemplates | src/aria/DomEvent.js | function (type, target) {
var evt = new aria.DomEvent({
type : type
});
evt.type = type;
evt.target = target;
return evt;
} | javascript | function (type, target) {
var evt = new aria.DomEvent({
type : type
});
evt.type = type;
evt.target = target;
return evt;
} | [
"function",
"(",
"type",
",",
"target",
")",
"{",
"var",
"evt",
"=",
"new",
"aria",
".",
"DomEvent",
"(",
"{",
"type",
":",
"type",
"}",
")",
";",
"evt",
".",
"type",
"=",
"type",
";",
"evt",
".",
"target",
"=",
"target",
";",
"return",
"evt",
";",
"}"
]
| Returns an object with appropriate
@param {String} type
@param {HTMLElement} target | [
"Returns",
"an",
"object",
"with",
"appropriate"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/DomEvent.js#L489-L496 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/DropDownTextInput.js | function (event) {
// PROFILING // var profilingId = this.$startMeasure("handle key " + String.fromCharCode(event.charCode)
// PROFILING // + " (" + event.charCode + ")");
if (this.controller) {
if (!event.ctrlKey && !event.altKey) {
// we ignore CTRL+ / ALT+ key presses
this._checkKeyStroke(event);
} else {
// alt or ctrl keys are pressed
// we check that copy/paste content is correct
ariaCoreTimer.addCallback({
fn : this._checkKeyStroke,
scope : this,
args : event,
delay : 4
});
}
}
// PROFILING // this.$stopMeasure(profilingId);
} | javascript | function (event) {
// PROFILING // var profilingId = this.$startMeasure("handle key " + String.fromCharCode(event.charCode)
// PROFILING // + " (" + event.charCode + ")");
if (this.controller) {
if (!event.ctrlKey && !event.altKey) {
// we ignore CTRL+ / ALT+ key presses
this._checkKeyStroke(event);
} else {
// alt or ctrl keys are pressed
// we check that copy/paste content is correct
ariaCoreTimer.addCallback({
fn : this._checkKeyStroke,
scope : this,
args : event,
delay : 4
});
}
}
// PROFILING // this.$stopMeasure(profilingId);
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"this",
".",
"controller",
")",
"{",
"if",
"(",
"!",
"event",
".",
"ctrlKey",
"&&",
"!",
"event",
".",
"altKey",
")",
"{",
"this",
".",
"_checkKeyStroke",
"(",
"event",
")",
";",
"}",
"else",
"{",
"ariaCoreTimer",
".",
"addCallback",
"(",
"{",
"fn",
":",
"this",
".",
"_checkKeyStroke",
",",
"scope",
":",
"this",
",",
"args",
":",
"event",
",",
"delay",
":",
"4",
"}",
")",
";",
"}",
"}",
"}"
]
| Handle key event on keydown or keypress. This function is asynchronous for special keys
@protected
@param {Object|aria.DomEvent} event object containing keyboard event information (at least charCode and
keyCode properties). This object may be or may not be an instance of aria.DomEvent. | [
"Handle",
"key",
"event",
"on",
"keydown",
"or",
"keypress",
".",
"This",
"function",
"is",
"asynchronous",
"for",
"special",
"keys"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DropDownTextInput.js#L113-L132 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/DropDownTextInput.js | function (event) {
if (this._cfg.waiAria && !this._dropdownPopup && event.keyCode === DomEvent.KC_DOWN) {
// disable arrow down key when waiAria is enabled and the popup is closed
return;
}
var controller = this.controller;
var cp = this.getCaretPosition();
if (cp) {
var report = controller.checkKeyStroke(event.charCode, event.keyCode, this.getTextInputField().value, cp.start, cp.end, event);
// event may not always be a DomEvent object, that's why we check for the existence of
// preventDefault on it
if (report && event.preventDefault) {
if (report.cancelKeyStroke) {
event.preventDefault(true);
} else if (report.cancelKeyStrokeDefaultBehavior) {
event.preventDefault(false);
}
}
this._reactToControllerReport(report, {
hasFocus : true
});
}
} | javascript | function (event) {
if (this._cfg.waiAria && !this._dropdownPopup && event.keyCode === DomEvent.KC_DOWN) {
// disable arrow down key when waiAria is enabled and the popup is closed
return;
}
var controller = this.controller;
var cp = this.getCaretPosition();
if (cp) {
var report = controller.checkKeyStroke(event.charCode, event.keyCode, this.getTextInputField().value, cp.start, cp.end, event);
// event may not always be a DomEvent object, that's why we check for the existence of
// preventDefault on it
if (report && event.preventDefault) {
if (report.cancelKeyStroke) {
event.preventDefault(true);
} else if (report.cancelKeyStrokeDefaultBehavior) {
event.preventDefault(false);
}
}
this._reactToControllerReport(report, {
hasFocus : true
});
}
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"this",
".",
"_cfg",
".",
"waiAria",
"&&",
"!",
"this",
".",
"_dropdownPopup",
"&&",
"event",
".",
"keyCode",
"===",
"DomEvent",
".",
"KC_DOWN",
")",
"{",
"return",
";",
"}",
"var",
"controller",
"=",
"this",
".",
"controller",
";",
"var",
"cp",
"=",
"this",
".",
"getCaretPosition",
"(",
")",
";",
"if",
"(",
"cp",
")",
"{",
"var",
"report",
"=",
"controller",
".",
"checkKeyStroke",
"(",
"event",
".",
"charCode",
",",
"event",
".",
"keyCode",
",",
"this",
".",
"getTextInputField",
"(",
")",
".",
"value",
",",
"cp",
".",
"start",
",",
"cp",
".",
"end",
",",
"event",
")",
";",
"if",
"(",
"report",
"&&",
"event",
".",
"preventDefault",
")",
"{",
"if",
"(",
"report",
".",
"cancelKeyStroke",
")",
"{",
"event",
".",
"preventDefault",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"report",
".",
"cancelKeyStrokeDefaultBehavior",
")",
"{",
"event",
".",
"preventDefault",
"(",
"false",
")",
";",
"}",
"}",
"this",
".",
"_reactToControllerReport",
"(",
"report",
",",
"{",
"hasFocus",
":",
"true",
"}",
")",
";",
"}",
"}"
]
| Handle key event on keydown or keypress. Synchronous function
@see _handleKey
@protected
@param {Object|aria.DomEvent} event object containing keyboard event information (at least charCode and
keyCode properties). This object may be or may not be an instance of aria.DomEvent. | [
"Handle",
"key",
"event",
"on",
"keydown",
"or",
"keypress",
".",
"Synchronous",
"function"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DropDownTextInput.js#L141-L163 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/DropDownTextInput.js | function (event) {
var browser = ariaCoreBrowser;
if (browser.isAndroid && browser.isChrome && !event.isSpecialKey && event.keyCode == 229) {
event.charCode = 0;
this._handleKey(event);
}
this.$TextInput._dom_onkeyup.call(this, event);
} | javascript | function (event) {
var browser = ariaCoreBrowser;
if (browser.isAndroid && browser.isChrome && !event.isSpecialKey && event.keyCode == 229) {
event.charCode = 0;
this._handleKey(event);
}
this.$TextInput._dom_onkeyup.call(this, event);
} | [
"function",
"(",
"event",
")",
"{",
"var",
"browser",
"=",
"ariaCoreBrowser",
";",
"if",
"(",
"browser",
".",
"isAndroid",
"&&",
"browser",
".",
"isChrome",
"&&",
"!",
"event",
".",
"isSpecialKey",
"&&",
"event",
".",
"keyCode",
"==",
"229",
")",
"{",
"event",
".",
"charCode",
"=",
"0",
";",
"this",
".",
"_handleKey",
"(",
"event",
")",
";",
"}",
"this",
".",
"$TextInput",
".",
"_dom_onkeyup",
".",
"call",
"(",
"this",
",",
"event",
")",
";",
"}"
]
| Internal method to handle the keyup event. It is needed because in some cases the keypress event is not
raised
@protected
@param {aria.DomEvent} event | [
"Internal",
"method",
"to",
"handle",
"the",
"keyup",
"event",
".",
"It",
"is",
"needed",
"because",
"in",
"some",
"cases",
"the",
"keypress",
"event",
"is",
"not",
"raised"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DropDownTextInput.js#L186-L193 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/DropDownTextInput.js | function () {
var touchFocusSpan = this._touchFocusSpan;
if (!touchFocusSpan) {
touchFocusSpan = this._touchFocusSpan = Aria.$window.document.createElement("span");
touchFocusSpan.setAttribute("tabIndex", "-1");
var widgetDomElt = this.getDom();
widgetDomElt.appendChild(touchFocusSpan);
}
touchFocusSpan.focus();
} | javascript | function () {
var touchFocusSpan = this._touchFocusSpan;
if (!touchFocusSpan) {
touchFocusSpan = this._touchFocusSpan = Aria.$window.document.createElement("span");
touchFocusSpan.setAttribute("tabIndex", "-1");
var widgetDomElt = this.getDom();
widgetDomElt.appendChild(touchFocusSpan);
}
touchFocusSpan.focus();
} | [
"function",
"(",
")",
"{",
"var",
"touchFocusSpan",
"=",
"this",
".",
"_touchFocusSpan",
";",
"if",
"(",
"!",
"touchFocusSpan",
")",
"{",
"touchFocusSpan",
"=",
"this",
".",
"_touchFocusSpan",
"=",
"Aria",
".",
"$window",
".",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"touchFocusSpan",
".",
"setAttribute",
"(",
"\"tabIndex\"",
",",
"\"-1\"",
")",
";",
"var",
"widgetDomElt",
"=",
"this",
".",
"getDom",
"(",
")",
";",
"widgetDomElt",
".",
"appendChild",
"(",
"touchFocusSpan",
")",
";",
"}",
"touchFocusSpan",
".",
"focus",
"(",
")",
";",
"}"
]
| This method focuses the widget without making the virtual keyboard appear on touch devices. | [
"This",
"method",
"focuses",
"the",
"widget",
"without",
"making",
"the",
"virtual",
"keyboard",
"appear",
"on",
"touch",
"devices",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DropDownTextInput.js#L290-L299 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/DropDownTextInput.js | function (evt) {
var domEvent = evt.domEvent;
if (domEvent.target == this.getTextInputField()) {
// Clicking on the input should directly give the focus to the input.
// Setting this boolean to false prevents the focus from being given
// to this._touchFocusSpan when the dropdown is closed (which would
// be temporary anyway, but would make Edge fail on DatePickerInputTouchTest)
this._focusNoKeyboard = false;
}
this.$DropDownTrait._dropDownMouseClickClose.call(this, evt);
} | javascript | function (evt) {
var domEvent = evt.domEvent;
if (domEvent.target == this.getTextInputField()) {
// Clicking on the input should directly give the focus to the input.
// Setting this boolean to false prevents the focus from being given
// to this._touchFocusSpan when the dropdown is closed (which would
// be temporary anyway, but would make Edge fail on DatePickerInputTouchTest)
this._focusNoKeyboard = false;
}
this.$DropDownTrait._dropDownMouseClickClose.call(this, evt);
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"domEvent",
"=",
"evt",
".",
"domEvent",
";",
"if",
"(",
"domEvent",
".",
"target",
"==",
"this",
".",
"getTextInputField",
"(",
")",
")",
"{",
"this",
".",
"_focusNoKeyboard",
"=",
"false",
";",
"}",
"this",
".",
"$DropDownTrait",
".",
"_dropDownMouseClickClose",
".",
"call",
"(",
"this",
",",
"evt",
")",
";",
"}"
]
| Callback for the event onMouseClickClose raised by the popup.
@protected | [
"Callback",
"for",
"the",
"event",
"onMouseClickClose",
"raised",
"by",
"the",
"popup",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DropDownTextInput.js#L305-L315 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/DropDownTextInput.js | function () {
var dropDownIcon = this._dropDownIcon;
if (!dropDownIcon && this._frame && this._frame.getIcon) {
dropDownIcon = this._dropDownIcon = this._frame.getIcon("dropdown");
}
return dropDownIcon;
} | javascript | function () {
var dropDownIcon = this._dropDownIcon;
if (!dropDownIcon && this._frame && this._frame.getIcon) {
dropDownIcon = this._dropDownIcon = this._frame.getIcon("dropdown");
}
return dropDownIcon;
} | [
"function",
"(",
")",
"{",
"var",
"dropDownIcon",
"=",
"this",
".",
"_dropDownIcon",
";",
"if",
"(",
"!",
"dropDownIcon",
"&&",
"this",
".",
"_frame",
"&&",
"this",
".",
"_frame",
".",
"getIcon",
")",
"{",
"dropDownIcon",
"=",
"this",
".",
"_dropDownIcon",
"=",
"this",
".",
"_frame",
".",
"getIcon",
"(",
"\"dropdown\"",
")",
";",
"}",
"return",
"dropDownIcon",
";",
"}"
]
| Return the dropdown icon
@protected | [
"Return",
"the",
"dropdown",
"icon"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DropDownTextInput.js#L321-L327 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/Select.js | function () {
this._hasFocus = false;
this._updateState();
if (this._cfg.formatError && this._cfg.validationEvent === 'onBlur') {// show
// errortip on blur used for debug purposes
this._validationPopupShow();
} else { // dispose of error tip
this._validationPopupHide();
if (this._cfg.directOnBlurValidation) {
if (this._cfg.bind) {
var bind = this._cfg.bind.value;
if (bind) {
var dataholder = bind.inside;
var name = bind.to;
var groups = this._cfg.validationGroups;
aria.utils.Data.validateValue(dataholder, name, null, groups, 'onblur');
}
}
}
}
this._updateValue(true);
// _updateValue can change the value in the data model, which could make the widget be disposed
// (for example during a refresh of a section bound to that part of the data model)
// That's why we are checking if this._cfg is defined here:
var onblur = this._cfg ? this._cfg.onblur : null;
if (onblur) {
this.evalCallback(onblur);
}
} | javascript | function () {
this._hasFocus = false;
this._updateState();
if (this._cfg.formatError && this._cfg.validationEvent === 'onBlur') {// show
// errortip on blur used for debug purposes
this._validationPopupShow();
} else { // dispose of error tip
this._validationPopupHide();
if (this._cfg.directOnBlurValidation) {
if (this._cfg.bind) {
var bind = this._cfg.bind.value;
if (bind) {
var dataholder = bind.inside;
var name = bind.to;
var groups = this._cfg.validationGroups;
aria.utils.Data.validateValue(dataholder, name, null, groups, 'onblur');
}
}
}
}
this._updateValue(true);
// _updateValue can change the value in the data model, which could make the widget be disposed
// (for example during a refresh of a section bound to that part of the data model)
// That's why we are checking if this._cfg is defined here:
var onblur = this._cfg ? this._cfg.onblur : null;
if (onblur) {
this.evalCallback(onblur);
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"_hasFocus",
"=",
"false",
";",
"this",
".",
"_updateState",
"(",
")",
";",
"if",
"(",
"this",
".",
"_cfg",
".",
"formatError",
"&&",
"this",
".",
"_cfg",
".",
"validationEvent",
"===",
"'onBlur'",
")",
"{",
"this",
".",
"_validationPopupShow",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"_validationPopupHide",
"(",
")",
";",
"if",
"(",
"this",
".",
"_cfg",
".",
"directOnBlurValidation",
")",
"{",
"if",
"(",
"this",
".",
"_cfg",
".",
"bind",
")",
"{",
"var",
"bind",
"=",
"this",
".",
"_cfg",
".",
"bind",
".",
"value",
";",
"if",
"(",
"bind",
")",
"{",
"var",
"dataholder",
"=",
"bind",
".",
"inside",
";",
"var",
"name",
"=",
"bind",
".",
"to",
";",
"var",
"groups",
"=",
"this",
".",
"_cfg",
".",
"validationGroups",
";",
"aria",
".",
"utils",
".",
"Data",
".",
"validateValue",
"(",
"dataholder",
",",
"name",
",",
"null",
",",
"groups",
",",
"'onblur'",
")",
";",
"}",
"}",
"}",
"}",
"this",
".",
"_updateValue",
"(",
"true",
")",
";",
"var",
"onblur",
"=",
"this",
".",
"_cfg",
"?",
"this",
".",
"_cfg",
".",
"onblur",
":",
"null",
";",
"if",
"(",
"onblur",
")",
"{",
"this",
".",
"evalCallback",
"(",
"onblur",
")",
";",
"}",
"}"
]
| Internal method to handle the blur event
@protected
@param {aria.DomEvent} event Blur event | [
"Internal",
"method",
"to",
"handle",
"the",
"blur",
"event"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/Select.js#L218-L246 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/Select.js | function (evt) {
var target = evt.target;
var inputDomElt = this._getInputMarkupDomElt();
if (this.controller && ariaUtilsDom.isAncestor(target, inputDomElt)) {
this._toggleDropdown();
evt.preventDefault(); // prevent the selection of the text when clicking
}
} | javascript | function (evt) {
var target = evt.target;
var inputDomElt = this._getInputMarkupDomElt();
if (this.controller && ariaUtilsDom.isAncestor(target, inputDomElt)) {
this._toggleDropdown();
evt.preventDefault(); // prevent the selection of the text when clicking
}
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"target",
"=",
"evt",
".",
"target",
";",
"var",
"inputDomElt",
"=",
"this",
".",
"_getInputMarkupDomElt",
"(",
")",
";",
"if",
"(",
"this",
".",
"controller",
"&&",
"ariaUtilsDom",
".",
"isAncestor",
"(",
"target",
",",
"inputDomElt",
")",
")",
"{",
"this",
".",
"_toggleDropdown",
"(",
")",
";",
"evt",
".",
"preventDefault",
"(",
")",
";",
"}",
"}"
]
| Internal method to handle the mousedown event
@protected
@param {aria.DomEvent} event Mouse down event | [
"Internal",
"method",
"to",
"handle",
"the",
"mousedown",
"event"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/Select.js#L269-L276 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/Select.js | function (event) {
var domEvent = aria.DomEvent;
if (event.keyCode === domEvent.KC_ENTER) {
this._updateValue(false);
}
this.$DropDownInput._dom_onkeypress.call(this, event);
} | javascript | function (event) {
var domEvent = aria.DomEvent;
if (event.keyCode === domEvent.KC_ENTER) {
this._updateValue(false);
}
this.$DropDownInput._dom_onkeypress.call(this, event);
} | [
"function",
"(",
"event",
")",
"{",
"var",
"domEvent",
"=",
"aria",
".",
"DomEvent",
";",
"if",
"(",
"event",
".",
"keyCode",
"===",
"domEvent",
".",
"KC_ENTER",
")",
"{",
"this",
".",
"_updateValue",
"(",
"false",
")",
";",
"}",
"this",
".",
"$DropDownInput",
".",
"_dom_onkeypress",
".",
"call",
"(",
"this",
",",
"event",
")",
";",
"}"
]
| Internal method to handle the keypress event
@protected
@param {aria.DomEvent} event Key press event | [
"Internal",
"method",
"to",
"handle",
"the",
"keypress",
"event"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/Select.js#L301-L307 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/Select.js | function (includeController) {
var hasChanged = null;
if (this._skinObj.simpleHTML) {
hasChanged = this.setProperty("value", this.getSelectField().value);
} else if (includeController) {
var controller = this.controller;
var dataModel = controller.getDataModel();
hasChanged = this.setProperty("value", dataModel.value);
}
// PTR05634154: setProperty can dispose the widget
// (that's why we are checking this._cfg)
if (this._cfg) {
if (hasChanged != null) {
this.changeProperty("error", false);
if (!(this._cfg.formatError && this._cfg.formatErrorMessages.length)
|| (this._cfg.error && this._cfg.errorMessages.length)) {
this._validationPopupHide();
}
if (this._cfg.onchange) {
this.evalCallback(this._cfg.onchange);
}
}
}
} | javascript | function (includeController) {
var hasChanged = null;
if (this._skinObj.simpleHTML) {
hasChanged = this.setProperty("value", this.getSelectField().value);
} else if (includeController) {
var controller = this.controller;
var dataModel = controller.getDataModel();
hasChanged = this.setProperty("value", dataModel.value);
}
// PTR05634154: setProperty can dispose the widget
// (that's why we are checking this._cfg)
if (this._cfg) {
if (hasChanged != null) {
this.changeProperty("error", false);
if (!(this._cfg.formatError && this._cfg.formatErrorMessages.length)
|| (this._cfg.error && this._cfg.errorMessages.length)) {
this._validationPopupHide();
}
if (this._cfg.onchange) {
this.evalCallback(this._cfg.onchange);
}
}
}
} | [
"function",
"(",
"includeController",
")",
"{",
"var",
"hasChanged",
"=",
"null",
";",
"if",
"(",
"this",
".",
"_skinObj",
".",
"simpleHTML",
")",
"{",
"hasChanged",
"=",
"this",
".",
"setProperty",
"(",
"\"value\"",
",",
"this",
".",
"getSelectField",
"(",
")",
".",
"value",
")",
";",
"}",
"else",
"if",
"(",
"includeController",
")",
"{",
"var",
"controller",
"=",
"this",
".",
"controller",
";",
"var",
"dataModel",
"=",
"controller",
".",
"getDataModel",
"(",
")",
";",
"hasChanged",
"=",
"this",
".",
"setProperty",
"(",
"\"value\"",
",",
"dataModel",
".",
"value",
")",
";",
"}",
"if",
"(",
"this",
".",
"_cfg",
")",
"{",
"if",
"(",
"hasChanged",
"!=",
"null",
")",
"{",
"this",
".",
"changeProperty",
"(",
"\"error\"",
",",
"false",
")",
";",
"if",
"(",
"!",
"(",
"this",
".",
"_cfg",
".",
"formatError",
"&&",
"this",
".",
"_cfg",
".",
"formatErrorMessages",
".",
"length",
")",
"||",
"(",
"this",
".",
"_cfg",
".",
"error",
"&&",
"this",
".",
"_cfg",
".",
"errorMessages",
".",
"length",
")",
")",
"{",
"this",
".",
"_validationPopupHide",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"_cfg",
".",
"onchange",
")",
"{",
"this",
".",
"evalCallback",
"(",
"this",
".",
"_cfg",
".",
"onchange",
")",
";",
"}",
"}",
"}",
"}"
]
| Copies the value from the widget to the data model.
@param {Boolean} includeController whether to copy the value from the controller to the data model.
@protected | [
"Copies",
"the",
"value",
"from",
"the",
"widget",
"to",
"the",
"data",
"model",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/Select.js#L327-L351 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/Select.js | function (out) {
var cfg = this._cfg;
var width = this._frame.innerWidth;
var disabledOrReadonly = cfg.disabled || cfg.readOnly;
var tabIndex = disabledOrReadonly ? '' : ' tabindex="' + this._calculateTabIndex() + '"';
if (this._skinObj.simpleHTML) {
var stringUtils = ariaUtilsString;
var options = cfg.options;
var selectedValue = cfg.value;
/*
* The _ariaInput attribute is present so that pressing ENTER on this widget raises the onSubmit event
* of the fieldset:
*/
var html = ['<select', Aria.testMode ? ' id="' + this._domId + '_input"' : '',
(width > 0) ? ' style="width: ' + width + 'px;" ' : '', tabIndex,
disabledOrReadonly ? ' disabled="disabled"' : '', this._getAriaLabelMarkup(),
' _ariaInput="1">'];
for (var i = 0, l = options.length; i < l; i++) {
// string cast, otherwise encoding will fail
var optValue = '' + options[i].value;
html.push('<option value="', stringUtils.encodeForQuotedHTMLAttribute(optValue), '"', optValue == selectedValue
? ' selected="selected"'
: '', '>', stringUtils.escapeHTML(options[i].label), '</option>');
}
html.push('</select>');
out.write(html.join(''));
} else {
var report = this.controller.checkValue(cfg.value);
var text = report.text;
report.$dispose();
// The _ariaInput attribute is present so that pressing ENTER on this widget raises the onSubmit event
// of the fieldset:
out.write(['<span', Aria.testMode ? ' id="' + this._domId + '_input"' : '', ' class="xSelect" style="',
(width > 0) ? 'width:' + width + 'px;' : '', '"', tabIndex, this._getAriaLabelMarkup(),
' _ariaInput="1">', ariaUtilsString.escapeHTML(text), ' </span>'].join(''));
// the at the end of the label is useful to make sure there is always something in the line so
// that the height does not change
}
} | javascript | function (out) {
var cfg = this._cfg;
var width = this._frame.innerWidth;
var disabledOrReadonly = cfg.disabled || cfg.readOnly;
var tabIndex = disabledOrReadonly ? '' : ' tabindex="' + this._calculateTabIndex() + '"';
if (this._skinObj.simpleHTML) {
var stringUtils = ariaUtilsString;
var options = cfg.options;
var selectedValue = cfg.value;
/*
* The _ariaInput attribute is present so that pressing ENTER on this widget raises the onSubmit event
* of the fieldset:
*/
var html = ['<select', Aria.testMode ? ' id="' + this._domId + '_input"' : '',
(width > 0) ? ' style="width: ' + width + 'px;" ' : '', tabIndex,
disabledOrReadonly ? ' disabled="disabled"' : '', this._getAriaLabelMarkup(),
' _ariaInput="1">'];
for (var i = 0, l = options.length; i < l; i++) {
// string cast, otherwise encoding will fail
var optValue = '' + options[i].value;
html.push('<option value="', stringUtils.encodeForQuotedHTMLAttribute(optValue), '"', optValue == selectedValue
? ' selected="selected"'
: '', '>', stringUtils.escapeHTML(options[i].label), '</option>');
}
html.push('</select>');
out.write(html.join(''));
} else {
var report = this.controller.checkValue(cfg.value);
var text = report.text;
report.$dispose();
// The _ariaInput attribute is present so that pressing ENTER on this widget raises the onSubmit event
// of the fieldset:
out.write(['<span', Aria.testMode ? ' id="' + this._domId + '_input"' : '', ' class="xSelect" style="',
(width > 0) ? 'width:' + width + 'px;' : '', '"', tabIndex, this._getAriaLabelMarkup(),
' _ariaInput="1">', ariaUtilsString.escapeHTML(text), ' </span>'].join(''));
// the at the end of the label is useful to make sure there is always something in the line so
// that the height does not change
}
} | [
"function",
"(",
"out",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"var",
"width",
"=",
"this",
".",
"_frame",
".",
"innerWidth",
";",
"var",
"disabledOrReadonly",
"=",
"cfg",
".",
"disabled",
"||",
"cfg",
".",
"readOnly",
";",
"var",
"tabIndex",
"=",
"disabledOrReadonly",
"?",
"''",
":",
"' tabindex=\"'",
"+",
"this",
".",
"_calculateTabIndex",
"(",
")",
"+",
"'\"'",
";",
"if",
"(",
"this",
".",
"_skinObj",
".",
"simpleHTML",
")",
"{",
"var",
"stringUtils",
"=",
"ariaUtilsString",
";",
"var",
"options",
"=",
"cfg",
".",
"options",
";",
"var",
"selectedValue",
"=",
"cfg",
".",
"value",
";",
"var",
"html",
"=",
"[",
"'<select'",
",",
"Aria",
".",
"testMode",
"?",
"' id=\"'",
"+",
"this",
".",
"_domId",
"+",
"'_input\"'",
":",
"''",
",",
"(",
"width",
">",
"0",
")",
"?",
"' style=\"width: '",
"+",
"width",
"+",
"'px;\" '",
":",
"''",
",",
"tabIndex",
",",
"disabledOrReadonly",
"?",
"' disabled=\"disabled\"'",
":",
"''",
",",
"this",
".",
"_getAriaLabelMarkup",
"(",
")",
",",
"' _ariaInput=\"1\">'",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"options",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"var",
"optValue",
"=",
"''",
"+",
"options",
"[",
"i",
"]",
".",
"value",
";",
"html",
".",
"push",
"(",
"'<option value=\"'",
",",
"stringUtils",
".",
"encodeForQuotedHTMLAttribute",
"(",
"optValue",
")",
",",
"'\"'",
",",
"optValue",
"==",
"selectedValue",
"?",
"' selected=\"selected\"'",
":",
"''",
",",
"'>'",
",",
"stringUtils",
".",
"escapeHTML",
"(",
"options",
"[",
"i",
"]",
".",
"label",
")",
",",
"'</option>'",
")",
";",
"}",
"html",
".",
"push",
"(",
"'</select>'",
")",
";",
"out",
".",
"write",
"(",
"html",
".",
"join",
"(",
"''",
")",
")",
";",
"}",
"else",
"{",
"var",
"report",
"=",
"this",
".",
"controller",
".",
"checkValue",
"(",
"cfg",
".",
"value",
")",
";",
"var",
"text",
"=",
"report",
".",
"text",
";",
"report",
".",
"$dispose",
"(",
")",
";",
"out",
".",
"write",
"(",
"[",
"'<span'",
",",
"Aria",
".",
"testMode",
"?",
"' id=\"'",
"+",
"this",
".",
"_domId",
"+",
"'_input\"'",
":",
"''",
",",
"' class=\"xSelect\" style=\"'",
",",
"(",
"width",
">",
"0",
")",
"?",
"'width:'",
"+",
"width",
"+",
"'px;'",
":",
"''",
",",
"'\"'",
",",
"tabIndex",
",",
"this",
".",
"_getAriaLabelMarkup",
"(",
")",
",",
"' _ariaInput=\"1\">'",
",",
"ariaUtilsString",
".",
"escapeHTML",
"(",
"text",
")",
",",
"' </span>'",
"]",
".",
"join",
"(",
"''",
")",
")",
";",
"}",
"}"
]
| Creates the markup for the select for both the simple HTML and AT skin versions.
@param {aria.templates.MarkupWriter} out Markup writer
@protected | [
"Creates",
"the",
"markup",
"for",
"the",
"select",
"for",
"both",
"the",
"simple",
"HTML",
"and",
"AT",
"skin",
"versions",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/Select.js#L369-L411 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/Select.js | function (propertyName, newValue, oldValue) {
if (propertyName === 'value') {
this._checkValue();// checks the value changed in the data model is a valid value from the select
// options
if (this.controller) {
var report = this.controller.checkValue(newValue);
this._reactToControllerReport(report, {
stopValueProp : true
});
} else {
this._selectValue(newValue);
}
} else if (propertyName === 'mandatory') {
this._updateState();
} else if (propertyName === 'readOnly' || propertyName === 'disabled') {
var selectField = this.getSelectField();
var disabledOrReadonly = this.getProperty("disabled") || this.getProperty("readOnly");
if (this._skinObj.simpleHTML) {
selectField.disabled = disabledOrReadonly ? "disabled" : "";
}
var tabIndex = disabledOrReadonly ? -1 : this._calculateTabIndex();
selectField.tabIndex = tabIndex;
this._updateState();
} else if (propertyName === 'options') {
if (this.controller) {
var selectValue = this.controller.getDataModel().value;
this.controller.setListOptions(newValue);
var report = this.controller.checkValue(selectValue);
this._reactToControllerReport(report, {
stopValueProp : false
});
} else {
// markup for the options
var optionsMarkup = [];
var stringUtils = ariaUtilsString;
for (var i = 0, l = newValue.length; i < l; i++) {
// string cast, otherwise encoding will fail
var optValue = '' + newValue[i].value;
optionsMarkup.push('<option value="', stringUtils.encodeForQuotedHTMLAttribute(optValue), '">', stringUtils.escapeHTML(newValue[i].label), '</option>');
}
var selectField = this.getSelectField();
var currentValue = selectField.value;
// update the options list
var optionsListString = optionsMarkup.join('');
if (ariaCoreBrowser.isIE9 || ariaCoreBrowser.isIE8 || ariaCoreBrowser.isIE7) {
// innerHTML replacing in IE truncates the first element and breaks the whole select...
selectField.innerHTML = '';
var helperDiv = Aria.$window.document.createElement('div');
helperDiv.innerHTML = '<select>' + optionsListString + '</select>';
var options = helperDiv.children[0].children;
while (options.length) {
selectField.appendChild(options[0]);
}
} else {
selectField.innerHTML = optionsListString;
}
this._selectValue(currentValue);
}
} else if (propertyName === 'formatError' || propertyName === 'formatErrorMessages'
|| propertyName === 'error' || propertyName === 'errorMessages') {
this._cfg[propertyName] = newValue;
this._updateState();
} else {
this.$DropDownInput._onBoundPropertyChange.apply(this, arguments);
}
} | javascript | function (propertyName, newValue, oldValue) {
if (propertyName === 'value') {
this._checkValue();// checks the value changed in the data model is a valid value from the select
// options
if (this.controller) {
var report = this.controller.checkValue(newValue);
this._reactToControllerReport(report, {
stopValueProp : true
});
} else {
this._selectValue(newValue);
}
} else if (propertyName === 'mandatory') {
this._updateState();
} else if (propertyName === 'readOnly' || propertyName === 'disabled') {
var selectField = this.getSelectField();
var disabledOrReadonly = this.getProperty("disabled") || this.getProperty("readOnly");
if (this._skinObj.simpleHTML) {
selectField.disabled = disabledOrReadonly ? "disabled" : "";
}
var tabIndex = disabledOrReadonly ? -1 : this._calculateTabIndex();
selectField.tabIndex = tabIndex;
this._updateState();
} else if (propertyName === 'options') {
if (this.controller) {
var selectValue = this.controller.getDataModel().value;
this.controller.setListOptions(newValue);
var report = this.controller.checkValue(selectValue);
this._reactToControllerReport(report, {
stopValueProp : false
});
} else {
// markup for the options
var optionsMarkup = [];
var stringUtils = ariaUtilsString;
for (var i = 0, l = newValue.length; i < l; i++) {
// string cast, otherwise encoding will fail
var optValue = '' + newValue[i].value;
optionsMarkup.push('<option value="', stringUtils.encodeForQuotedHTMLAttribute(optValue), '">', stringUtils.escapeHTML(newValue[i].label), '</option>');
}
var selectField = this.getSelectField();
var currentValue = selectField.value;
// update the options list
var optionsListString = optionsMarkup.join('');
if (ariaCoreBrowser.isIE9 || ariaCoreBrowser.isIE8 || ariaCoreBrowser.isIE7) {
// innerHTML replacing in IE truncates the first element and breaks the whole select...
selectField.innerHTML = '';
var helperDiv = Aria.$window.document.createElement('div');
helperDiv.innerHTML = '<select>' + optionsListString + '</select>';
var options = helperDiv.children[0].children;
while (options.length) {
selectField.appendChild(options[0]);
}
} else {
selectField.innerHTML = optionsListString;
}
this._selectValue(currentValue);
}
} else if (propertyName === 'formatError' || propertyName === 'formatErrorMessages'
|| propertyName === 'error' || propertyName === 'errorMessages') {
this._cfg[propertyName] = newValue;
this._updateState();
} else {
this.$DropDownInput._onBoundPropertyChange.apply(this, arguments);
}
} | [
"function",
"(",
"propertyName",
",",
"newValue",
",",
"oldValue",
")",
"{",
"if",
"(",
"propertyName",
"===",
"'value'",
")",
"{",
"this",
".",
"_checkValue",
"(",
")",
";",
"if",
"(",
"this",
".",
"controller",
")",
"{",
"var",
"report",
"=",
"this",
".",
"controller",
".",
"checkValue",
"(",
"newValue",
")",
";",
"this",
".",
"_reactToControllerReport",
"(",
"report",
",",
"{",
"stopValueProp",
":",
"true",
"}",
")",
";",
"}",
"else",
"{",
"this",
".",
"_selectValue",
"(",
"newValue",
")",
";",
"}",
"}",
"else",
"if",
"(",
"propertyName",
"===",
"'mandatory'",
")",
"{",
"this",
".",
"_updateState",
"(",
")",
";",
"}",
"else",
"if",
"(",
"propertyName",
"===",
"'readOnly'",
"||",
"propertyName",
"===",
"'disabled'",
")",
"{",
"var",
"selectField",
"=",
"this",
".",
"getSelectField",
"(",
")",
";",
"var",
"disabledOrReadonly",
"=",
"this",
".",
"getProperty",
"(",
"\"disabled\"",
")",
"||",
"this",
".",
"getProperty",
"(",
"\"readOnly\"",
")",
";",
"if",
"(",
"this",
".",
"_skinObj",
".",
"simpleHTML",
")",
"{",
"selectField",
".",
"disabled",
"=",
"disabledOrReadonly",
"?",
"\"disabled\"",
":",
"\"\"",
";",
"}",
"var",
"tabIndex",
"=",
"disabledOrReadonly",
"?",
"-",
"1",
":",
"this",
".",
"_calculateTabIndex",
"(",
")",
";",
"selectField",
".",
"tabIndex",
"=",
"tabIndex",
";",
"this",
".",
"_updateState",
"(",
")",
";",
"}",
"else",
"if",
"(",
"propertyName",
"===",
"'options'",
")",
"{",
"if",
"(",
"this",
".",
"controller",
")",
"{",
"var",
"selectValue",
"=",
"this",
".",
"controller",
".",
"getDataModel",
"(",
")",
".",
"value",
";",
"this",
".",
"controller",
".",
"setListOptions",
"(",
"newValue",
")",
";",
"var",
"report",
"=",
"this",
".",
"controller",
".",
"checkValue",
"(",
"selectValue",
")",
";",
"this",
".",
"_reactToControllerReport",
"(",
"report",
",",
"{",
"stopValueProp",
":",
"false",
"}",
")",
";",
"}",
"else",
"{",
"var",
"optionsMarkup",
"=",
"[",
"]",
";",
"var",
"stringUtils",
"=",
"ariaUtilsString",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"newValue",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"var",
"optValue",
"=",
"''",
"+",
"newValue",
"[",
"i",
"]",
".",
"value",
";",
"optionsMarkup",
".",
"push",
"(",
"'<option value=\"'",
",",
"stringUtils",
".",
"encodeForQuotedHTMLAttribute",
"(",
"optValue",
")",
",",
"'\">'",
",",
"stringUtils",
".",
"escapeHTML",
"(",
"newValue",
"[",
"i",
"]",
".",
"label",
")",
",",
"'</option>'",
")",
";",
"}",
"var",
"selectField",
"=",
"this",
".",
"getSelectField",
"(",
")",
";",
"var",
"currentValue",
"=",
"selectField",
".",
"value",
";",
"var",
"optionsListString",
"=",
"optionsMarkup",
".",
"join",
"(",
"''",
")",
";",
"if",
"(",
"ariaCoreBrowser",
".",
"isIE9",
"||",
"ariaCoreBrowser",
".",
"isIE8",
"||",
"ariaCoreBrowser",
".",
"isIE7",
")",
"{",
"selectField",
".",
"innerHTML",
"=",
"''",
";",
"var",
"helperDiv",
"=",
"Aria",
".",
"$window",
".",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"helperDiv",
".",
"innerHTML",
"=",
"'<select>'",
"+",
"optionsListString",
"+",
"'</select>'",
";",
"var",
"options",
"=",
"helperDiv",
".",
"children",
"[",
"0",
"]",
".",
"children",
";",
"while",
"(",
"options",
".",
"length",
")",
"{",
"selectField",
".",
"appendChild",
"(",
"options",
"[",
"0",
"]",
")",
";",
"}",
"}",
"else",
"{",
"selectField",
".",
"innerHTML",
"=",
"optionsListString",
";",
"}",
"this",
".",
"_selectValue",
"(",
"currentValue",
")",
";",
"}",
"}",
"else",
"if",
"(",
"propertyName",
"===",
"'formatError'",
"||",
"propertyName",
"===",
"'formatErrorMessages'",
"||",
"propertyName",
"===",
"'error'",
"||",
"propertyName",
"===",
"'errorMessages'",
")",
"{",
"this",
".",
"_cfg",
"[",
"propertyName",
"]",
"=",
"newValue",
";",
"this",
".",
"_updateState",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"$DropDownInput",
".",
"_onBoundPropertyChange",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"}",
"}"
]
| Internal method called when the value property that the select is bound to has changed.
@param {String} propertyName the property name
@param {Object} newValue the new value
@param {Object} oldValue the old property value
@protected | [
"Internal",
"method",
"called",
"when",
"the",
"value",
"property",
"that",
"the",
"select",
"is",
"bound",
"to",
"has",
"changed",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/Select.js#L420-L487 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/Select.js | function (value) {
var selectField = this.getSelectField();
var options = selectField.options;
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option.value === value) {
option.selected = true;
return;
}
}
// In case we do not find any option matching the value, let's make sure no option
// is selected, this is especially necessary because of a weird bug in Chrome:
selectField.selectedIndex = -1;
} | javascript | function (value) {
var selectField = this.getSelectField();
var options = selectField.options;
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option.value === value) {
option.selected = true;
return;
}
}
// In case we do not find any option matching the value, let's make sure no option
// is selected, this is especially necessary because of a weird bug in Chrome:
selectField.selectedIndex = -1;
} | [
"function",
"(",
"value",
")",
"{",
"var",
"selectField",
"=",
"this",
".",
"getSelectField",
"(",
")",
";",
"var",
"options",
"=",
"selectField",
".",
"options",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"options",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"option",
"=",
"options",
"[",
"i",
"]",
";",
"if",
"(",
"option",
".",
"value",
"===",
"value",
")",
"{",
"option",
".",
"selected",
"=",
"true",
";",
"return",
";",
"}",
"}",
"selectField",
".",
"selectedIndex",
"=",
"-",
"1",
";",
"}"
]
| Set the 'selected' attribut on each options to true or false depending on the value
@param {String} value The value to compare
@private | [
"Set",
"the",
"selected",
"attribut",
"on",
"each",
"options",
"to",
"true",
"or",
"false",
"depending",
"on",
"the",
"value"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/Select.js#L494-L507 | train |
|
ariatemplates/ariatemplates | src/aria/utils/History.js | function (title) {
var document = window.document;
if (ariaUtilsType.isString(title)) {
document.title = title;
} else {
title = document.title;
}
return title;
} | javascript | function (title) {
var document = window.document;
if (ariaUtilsType.isString(title)) {
document.title = title;
} else {
title = document.title;
}
return title;
} | [
"function",
"(",
"title",
")",
"{",
"var",
"document",
"=",
"window",
".",
"document",
";",
"if",
"(",
"ariaUtilsType",
".",
"isString",
"(",
"title",
")",
")",
"{",
"document",
".",
"title",
"=",
"title",
";",
"}",
"else",
"{",
"title",
"=",
"document",
".",
"title",
";",
"}",
"return",
"title",
";",
"}"
]
| Set the title of the page.
@param {String} title
@return {String} Actual title of the page. If no argument is provided, it represents the actual title of
the page
@private | [
"Set",
"the",
"title",
"of",
"the",
"page",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/History.js#L361-L369 | train |
|
ariatemplates/ariatemplates | src/aria/utils/History.js | function () {
stateMemory.discarded = [];
if (this._isIE7OrLess) {
stateMemory.states = [stateMemory.states[this._currentPos]];
return;
}
var states = stateMemory.states;
var expirationTime = ((new Date()).getTime() - this.EXPIRATION_TIME * 1000) + "";
for (var i = 0; i < states.length; i++) {
if (states[i].id > expirationTime) {
break;
}
}
states.splice(0, i);
} | javascript | function () {
stateMemory.discarded = [];
if (this._isIE7OrLess) {
stateMemory.states = [stateMemory.states[this._currentPos]];
return;
}
var states = stateMemory.states;
var expirationTime = ((new Date()).getTime() - this.EXPIRATION_TIME * 1000) + "";
for (var i = 0; i < states.length; i++) {
if (states[i].id > expirationTime) {
break;
}
}
states.splice(0, i);
} | [
"function",
"(",
")",
"{",
"stateMemory",
".",
"discarded",
"=",
"[",
"]",
";",
"if",
"(",
"this",
".",
"_isIE7OrLess",
")",
"{",
"stateMemory",
".",
"states",
"=",
"[",
"stateMemory",
".",
"states",
"[",
"this",
".",
"_currentPos",
"]",
"]",
";",
"return",
";",
"}",
"var",
"states",
"=",
"stateMemory",
".",
"states",
";",
"var",
"expirationTime",
"=",
"(",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
"-",
"this",
".",
"EXPIRATION_TIME",
"*",
"1000",
")",
"+",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"states",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"states",
"[",
"i",
"]",
".",
"id",
">",
"expirationTime",
")",
"{",
"break",
";",
"}",
"}",
"states",
".",
"splice",
"(",
"0",
",",
"i",
")",
";",
"}"
]
| Remove old states that are present in the state store. States are considered old if they have been stored
more than aria.utils.History.EXPIRATION_TIME seconds before
@private | [
"Remove",
"old",
"states",
"that",
"are",
"present",
"in",
"the",
"state",
"store",
".",
"States",
"are",
"considered",
"old",
"if",
"they",
"have",
"been",
"stored",
"more",
"than",
"aria",
".",
"utils",
".",
"History",
".",
"EXPIRATION_TIME",
"seconds",
"before"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/History.js#L449-L463 | train |
|
ariatemplates/ariatemplates | src/aria/utils/History.js | function (evt) {
var state = ariaUtilsJson.copy(evt.state), title;
if (state && state.__info) {
title = state.__info.title;
delete state.__info;
} else {
var stateInfo = this._retrieveFromMemory();
title = stateInfo ? stateInfo.state.title : null;
}
this.state = state;
if (title) {
this._setTitle(title);
}
this.$raiseEvent({
name : "popstate",
state : state
});
} | javascript | function (evt) {
var state = ariaUtilsJson.copy(evt.state), title;
if (state && state.__info) {
title = state.__info.title;
delete state.__info;
} else {
var stateInfo = this._retrieveFromMemory();
title = stateInfo ? stateInfo.state.title : null;
}
this.state = state;
if (title) {
this._setTitle(title);
}
this.$raiseEvent({
name : "popstate",
state : state
});
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"state",
"=",
"ariaUtilsJson",
".",
"copy",
"(",
"evt",
".",
"state",
")",
",",
"title",
";",
"if",
"(",
"state",
"&&",
"state",
".",
"__info",
")",
"{",
"title",
"=",
"state",
".",
"__info",
".",
"title",
";",
"delete",
"state",
".",
"__info",
";",
"}",
"else",
"{",
"var",
"stateInfo",
"=",
"this",
".",
"_retrieveFromMemory",
"(",
")",
";",
"title",
"=",
"stateInfo",
"?",
"stateInfo",
".",
"state",
".",
"title",
":",
"null",
";",
"}",
"this",
".",
"state",
"=",
"state",
";",
"if",
"(",
"title",
")",
"{",
"this",
".",
"_setTitle",
"(",
"title",
")",
";",
"}",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"popstate\"",
",",
"state",
":",
"state",
"}",
")",
";",
"}"
]
| Methods that are specific to browsers that support HTML5 history API.
React to native onpopstate event by setting the title and raising the onpopstate class event. Only used
in browsers that support HTML5 history API.
@param {Object} Event object
@private | [
"Methods",
"that",
"are",
"specific",
"to",
"browsers",
"that",
"support",
"HTML5",
"history",
"API",
".",
"React",
"to",
"native",
"onpopstate",
"event",
"by",
"setting",
"the",
"title",
"and",
"raising",
"the",
"onpopstate",
"class",
"event",
".",
"Only",
"used",
"in",
"browsers",
"that",
"support",
"HTML5",
"history",
"API",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/History.js#L473-L490 | train |
|
ariatemplates/ariatemplates | src/aria/utils/History.js | function () {
var stateInfo = this._retrieveFromMemory();
var id = stateInfo ? stateInfo.state.id : null;
if (id && this._currentId != id && this._applyState(stateInfo)) {
this.state = this.getState();
this.$raiseEvent({
name : "popstate",
state : this.state
});
}
} | javascript | function () {
var stateInfo = this._retrieveFromMemory();
var id = stateInfo ? stateInfo.state.id : null;
if (id && this._currentId != id && this._applyState(stateInfo)) {
this.state = this.getState();
this.$raiseEvent({
name : "popstate",
state : this.state
});
}
} | [
"function",
"(",
")",
"{",
"var",
"stateInfo",
"=",
"this",
".",
"_retrieveFromMemory",
"(",
")",
";",
"var",
"id",
"=",
"stateInfo",
"?",
"stateInfo",
".",
"state",
".",
"id",
":",
"null",
";",
"if",
"(",
"id",
"&&",
"this",
".",
"_currentId",
"!=",
"id",
"&&",
"this",
".",
"_applyState",
"(",
"stateInfo",
")",
")",
"{",
"this",
".",
"state",
"=",
"this",
".",
"getState",
"(",
")",
";",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"popstate\"",
",",
"state",
":",
"this",
".",
"state",
"}",
")",
";",
"}",
"}"
]
| React to a hash change by retrieving the state from the store and raising the onpopstate event.
@private | [
"React",
"to",
"a",
"hash",
"change",
"by",
"retrieving",
"the",
"state",
"from",
"the",
"store",
"and",
"raising",
"the",
"onpopstate",
"event",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/History.js#L512-L522 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function (cfg) {
var skinObject = cfg.skinObject;
this._baseId = cfg.id;
this._skinObject = skinObject;
this._stateName = cfg.state;
this._iconsLeft = cfg.iconsLeft;
this._iconsRight = cfg.iconsRight;
this._icons = {};
/**
* Labels for the tooltips of active icon
* @protected
* @type Array
*/
this._tooltipLabels = cfg.tooltipLabels;
this._iconsAttributes = cfg.iconsAttributes;
this._iconsWaiLabel = cfg.iconsWaiLabel;
ariaUtilsArray.forEach(this._iconsLeft, this._initIcon, this);
ariaUtilsArray.forEach(this._iconsRight, this._initIcon, this);
this._outerWidth = cfg.width;
this._outerHeight = cfg.height;
this._updateIcons();
this._updateFrameWidth();
cfg.width = this._frameWidth;
this._frame = ariaWidgetsFramesFrameFactory.createFrame(cfg);
this.domElementNbr = this._frame.domElementNbr + this._iconsLeft.length + this._iconsRight.length;
this.innerWidth = this._frame.innerWidth;
this.innerHeight = this._frame.innerHeight;
} | javascript | function (cfg) {
var skinObject = cfg.skinObject;
this._baseId = cfg.id;
this._skinObject = skinObject;
this._stateName = cfg.state;
this._iconsLeft = cfg.iconsLeft;
this._iconsRight = cfg.iconsRight;
this._icons = {};
/**
* Labels for the tooltips of active icon
* @protected
* @type Array
*/
this._tooltipLabels = cfg.tooltipLabels;
this._iconsAttributes = cfg.iconsAttributes;
this._iconsWaiLabel = cfg.iconsWaiLabel;
ariaUtilsArray.forEach(this._iconsLeft, this._initIcon, this);
ariaUtilsArray.forEach(this._iconsRight, this._initIcon, this);
this._outerWidth = cfg.width;
this._outerHeight = cfg.height;
this._updateIcons();
this._updateFrameWidth();
cfg.width = this._frameWidth;
this._frame = ariaWidgetsFramesFrameFactory.createFrame(cfg);
this.domElementNbr = this._frame.domElementNbr + this._iconsLeft.length + this._iconsRight.length;
this.innerWidth = this._frame.innerWidth;
this.innerHeight = this._frame.innerHeight;
} | [
"function",
"(",
"cfg",
")",
"{",
"var",
"skinObject",
"=",
"cfg",
".",
"skinObject",
";",
"this",
".",
"_baseId",
"=",
"cfg",
".",
"id",
";",
"this",
".",
"_skinObject",
"=",
"skinObject",
";",
"this",
".",
"_stateName",
"=",
"cfg",
".",
"state",
";",
"this",
".",
"_iconsLeft",
"=",
"cfg",
".",
"iconsLeft",
";",
"this",
".",
"_iconsRight",
"=",
"cfg",
".",
"iconsRight",
";",
"this",
".",
"_icons",
"=",
"{",
"}",
";",
"this",
".",
"_tooltipLabels",
"=",
"cfg",
".",
"tooltipLabels",
";",
"this",
".",
"_iconsAttributes",
"=",
"cfg",
".",
"iconsAttributes",
";",
"this",
".",
"_iconsWaiLabel",
"=",
"cfg",
".",
"iconsWaiLabel",
";",
"ariaUtilsArray",
".",
"forEach",
"(",
"this",
".",
"_iconsLeft",
",",
"this",
".",
"_initIcon",
",",
"this",
")",
";",
"ariaUtilsArray",
".",
"forEach",
"(",
"this",
".",
"_iconsRight",
",",
"this",
".",
"_initIcon",
",",
"this",
")",
";",
"this",
".",
"_outerWidth",
"=",
"cfg",
".",
"width",
";",
"this",
".",
"_outerHeight",
"=",
"cfg",
".",
"height",
";",
"this",
".",
"_updateIcons",
"(",
")",
";",
"this",
".",
"_updateFrameWidth",
"(",
")",
";",
"cfg",
".",
"width",
"=",
"this",
".",
"_frameWidth",
";",
"this",
".",
"_frame",
"=",
"ariaWidgetsFramesFrameFactory",
".",
"createFrame",
"(",
"cfg",
")",
";",
"this",
".",
"domElementNbr",
"=",
"this",
".",
"_frame",
".",
"domElementNbr",
"+",
"this",
".",
"_iconsLeft",
".",
"length",
"+",
"this",
".",
"_iconsRight",
".",
"length",
";",
"this",
".",
"innerWidth",
"=",
"this",
".",
"_frame",
".",
"innerWidth",
";",
"this",
".",
"innerHeight",
"=",
"this",
".",
"_frame",
".",
"innerHeight",
";",
"}"
]
| FrameWithIcons constructor. Do not use directly, use the createFrame static method instead, so that the
FrameWithIcons is not used when there is no icon defined in the skin.
@private | [
"FrameWithIcons",
"constructor",
".",
"Do",
"not",
"use",
"directly",
"use",
"the",
"createFrame",
"static",
"method",
"instead",
"so",
"that",
"the",
"FrameWithIcons",
"is",
"not",
"used",
"when",
"there",
"is",
"no",
"icon",
"defined",
"in",
"the",
"skin",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L36-L73 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function (skinObject, hideIconNames) {
// normalize the skin:
if (skinObject.iconsLeft == null || skinObject.iconsLeft === "") {
skinObject.iconsLeft = [];
} else if (ariaUtilsType.isString(skinObject.iconsLeft)) {
skinObject.iconsLeft = skinObject.iconsLeft.split(',');
}
if (skinObject.iconsRight == null || skinObject.iconsRight === "") {
skinObject.iconsRight = [];
} else if (ariaUtilsType.isString(skinObject.iconsRight)) {
skinObject.iconsRight = skinObject.iconsRight.split(',');
}
var iconsLeft = this._filterIcons(skinObject.iconsLeft, hideIconNames);
var iconsRight = this._filterIcons(skinObject.iconsRight, hideIconNames);
return {
iconsLeft : iconsLeft,
iconsRight : iconsRight,
hasIcons : iconsLeft.length > 0 || iconsRight.length > 0
};
} | javascript | function (skinObject, hideIconNames) {
// normalize the skin:
if (skinObject.iconsLeft == null || skinObject.iconsLeft === "") {
skinObject.iconsLeft = [];
} else if (ariaUtilsType.isString(skinObject.iconsLeft)) {
skinObject.iconsLeft = skinObject.iconsLeft.split(',');
}
if (skinObject.iconsRight == null || skinObject.iconsRight === "") {
skinObject.iconsRight = [];
} else if (ariaUtilsType.isString(skinObject.iconsRight)) {
skinObject.iconsRight = skinObject.iconsRight.split(',');
}
var iconsLeft = this._filterIcons(skinObject.iconsLeft, hideIconNames);
var iconsRight = this._filterIcons(skinObject.iconsRight, hideIconNames);
return {
iconsLeft : iconsLeft,
iconsRight : iconsRight,
hasIcons : iconsLeft.length > 0 || iconsRight.length > 0
};
} | [
"function",
"(",
"skinObject",
",",
"hideIconNames",
")",
"{",
"if",
"(",
"skinObject",
".",
"iconsLeft",
"==",
"null",
"||",
"skinObject",
".",
"iconsLeft",
"===",
"\"\"",
")",
"{",
"skinObject",
".",
"iconsLeft",
"=",
"[",
"]",
";",
"}",
"else",
"if",
"(",
"ariaUtilsType",
".",
"isString",
"(",
"skinObject",
".",
"iconsLeft",
")",
")",
"{",
"skinObject",
".",
"iconsLeft",
"=",
"skinObject",
".",
"iconsLeft",
".",
"split",
"(",
"','",
")",
";",
"}",
"if",
"(",
"skinObject",
".",
"iconsRight",
"==",
"null",
"||",
"skinObject",
".",
"iconsRight",
"===",
"\"\"",
")",
"{",
"skinObject",
".",
"iconsRight",
"=",
"[",
"]",
";",
"}",
"else",
"if",
"(",
"ariaUtilsType",
".",
"isString",
"(",
"skinObject",
".",
"iconsRight",
")",
")",
"{",
"skinObject",
".",
"iconsRight",
"=",
"skinObject",
".",
"iconsRight",
".",
"split",
"(",
"','",
")",
";",
"}",
"var",
"iconsLeft",
"=",
"this",
".",
"_filterIcons",
"(",
"skinObject",
".",
"iconsLeft",
",",
"hideIconNames",
")",
";",
"var",
"iconsRight",
"=",
"this",
".",
"_filterIcons",
"(",
"skinObject",
".",
"iconsRight",
",",
"hideIconNames",
")",
";",
"return",
"{",
"iconsLeft",
":",
"iconsLeft",
",",
"iconsRight",
":",
"iconsRight",
",",
"hasIcons",
":",
"iconsLeft",
".",
"length",
">",
"0",
"||",
"iconsRight",
".",
"length",
">",
"0",
"}",
";",
"}"
]
| Computes the icons and returns the information about if the frame has icons or not.
@param {Object} skinObject Skin class object
@param {Array} hideIconNames Icons to be hidden
@return {Object} | [
"Computes",
"the",
"icons",
"and",
"returns",
"the",
"information",
"about",
"if",
"the",
"frame",
"has",
"icons",
"or",
"not",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L164-L185 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function (iconsList, iconNames) {
if (iconNames && iconNames.length > 0) {
var icons = [];
ariaUtilsArray.forEach(iconsList, function (item, i) {
if (!ariaUtilsArray.contains(iconNames, iconsList[i])) {
icons.push(iconsList[i]);
}
});
return icons;
}
return iconsList;
} | javascript | function (iconsList, iconNames) {
if (iconNames && iconNames.length > 0) {
var icons = [];
ariaUtilsArray.forEach(iconsList, function (item, i) {
if (!ariaUtilsArray.contains(iconNames, iconsList[i])) {
icons.push(iconsList[i]);
}
});
return icons;
}
return iconsList;
} | [
"function",
"(",
"iconsList",
",",
"iconNames",
")",
"{",
"if",
"(",
"iconNames",
"&&",
"iconNames",
".",
"length",
">",
"0",
")",
"{",
"var",
"icons",
"=",
"[",
"]",
";",
"ariaUtilsArray",
".",
"forEach",
"(",
"iconsList",
",",
"function",
"(",
"item",
",",
"i",
")",
"{",
"if",
"(",
"!",
"ariaUtilsArray",
".",
"contains",
"(",
"iconNames",
",",
"iconsList",
"[",
"i",
"]",
")",
")",
"{",
"icons",
".",
"push",
"(",
"iconsList",
"[",
"i",
"]",
")",
";",
"}",
"}",
")",
";",
"return",
"icons",
";",
"}",
"return",
"iconsList",
";",
"}"
]
| Does the filtering of icons
@param {Array} iconsList Icons to be displayed left or right
@param {Array} iconNames Icons to be removed from iconsList
@return {Array} | [
"Does",
"the",
"filtering",
"of",
"icons"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L192-L203 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function (out) {
var oSelf = this;
ariaUtilsArray.forEach(this._iconsLeft, function (value) {
oSelf._writeIcon(value, out);
});
this._frame.writeMarkupBegin(out);
} | javascript | function (out) {
var oSelf = this;
ariaUtilsArray.forEach(this._iconsLeft, function (value) {
oSelf._writeIcon(value, out);
});
this._frame.writeMarkupBegin(out);
} | [
"function",
"(",
"out",
")",
"{",
"var",
"oSelf",
"=",
"this",
";",
"ariaUtilsArray",
".",
"forEach",
"(",
"this",
".",
"_iconsLeft",
",",
"function",
"(",
"value",
")",
"{",
"oSelf",
".",
"_writeIcon",
"(",
"value",
",",
"out",
")",
";",
"}",
")",
";",
"this",
".",
"_frame",
".",
"writeMarkupBegin",
"(",
"out",
")",
";",
"}"
]
| Generate the begining of the markup for the frame.
@param {aria.templates.MarkupWriter} out | [
"Generate",
"the",
"begining",
"of",
"the",
"markup",
"for",
"the",
"frame",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L228-L234 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function (iconName) {
this._icons[iconName].domElts = null;
ariaUtilsDelegate.remove(this._icons[iconName].iconDelegateId);
this._icons[iconName] = null;
delete this._icons[iconName];
} | javascript | function (iconName) {
this._icons[iconName].domElts = null;
ariaUtilsDelegate.remove(this._icons[iconName].iconDelegateId);
this._icons[iconName] = null;
delete this._icons[iconName];
} | [
"function",
"(",
"iconName",
")",
"{",
"this",
".",
"_icons",
"[",
"iconName",
"]",
".",
"domElts",
"=",
"null",
";",
"ariaUtilsDelegate",
".",
"remove",
"(",
"this",
".",
"_icons",
"[",
"iconName",
"]",
".",
"iconDelegateId",
")",
";",
"this",
".",
"_icons",
"[",
"iconName",
"]",
"=",
"null",
";",
"delete",
"this",
".",
"_icons",
"[",
"iconName",
"]",
";",
"}"
]
| Destroy dom links for a given icon
@param {String} iconName | [
"Destroy",
"dom",
"links",
"for",
"a",
"given",
"icon"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L304-L309 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function () {
var param = {
width : 0,
activeIconIndex : 0
}, oSelf = this;
ariaUtilsArray.forEach(this._iconsLeft, function (value) {
oSelf._computeIconSize(value, param);
});
ariaUtilsArray.forEach(this._iconsRight, function (value) {
oSelf._computeIconSize(value, param);
});
this._iconsWidth = param.width;
} | javascript | function () {
var param = {
width : 0,
activeIconIndex : 0
}, oSelf = this;
ariaUtilsArray.forEach(this._iconsLeft, function (value) {
oSelf._computeIconSize(value, param);
});
ariaUtilsArray.forEach(this._iconsRight, function (value) {
oSelf._computeIconSize(value, param);
});
this._iconsWidth = param.width;
} | [
"function",
"(",
")",
"{",
"var",
"param",
"=",
"{",
"width",
":",
"0",
",",
"activeIconIndex",
":",
"0",
"}",
",",
"oSelf",
"=",
"this",
";",
"ariaUtilsArray",
".",
"forEach",
"(",
"this",
".",
"_iconsLeft",
",",
"function",
"(",
"value",
")",
"{",
"oSelf",
".",
"_computeIconSize",
"(",
"value",
",",
"param",
")",
";",
"}",
")",
";",
"ariaUtilsArray",
".",
"forEach",
"(",
"this",
".",
"_iconsRight",
",",
"function",
"(",
"value",
")",
"{",
"oSelf",
".",
"_computeIconSize",
"(",
"value",
",",
"param",
")",
";",
"}",
")",
";",
"this",
".",
"_iconsWidth",
"=",
"param",
".",
"width",
";",
"}"
]
| Updates this._iconsWidth and the iconInfo property for all icons, based on the current state.
@protected | [
"Updates",
"this",
".",
"_iconsWidth",
"and",
"the",
"iconInfo",
"property",
"for",
"all",
"icons",
"based",
"on",
"the",
"current",
"state",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L315-L327 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function () {
var outerWidth = this._outerWidth;
var newValue;
if (outerWidth < 0) {
newValue = -1;
} else {
newValue = outerWidth - this._iconsWidth;
if (newValue < 0) {
newValue = 0;
}
}
if (this._frameWidth !== newValue) {
this._frameWidth = newValue;
return true;
}
return false;
} | javascript | function () {
var outerWidth = this._outerWidth;
var newValue;
if (outerWidth < 0) {
newValue = -1;
} else {
newValue = outerWidth - this._iconsWidth;
if (newValue < 0) {
newValue = 0;
}
}
if (this._frameWidth !== newValue) {
this._frameWidth = newValue;
return true;
}
return false;
} | [
"function",
"(",
")",
"{",
"var",
"outerWidth",
"=",
"this",
".",
"_outerWidth",
";",
"var",
"newValue",
";",
"if",
"(",
"outerWidth",
"<",
"0",
")",
"{",
"newValue",
"=",
"-",
"1",
";",
"}",
"else",
"{",
"newValue",
"=",
"outerWidth",
"-",
"this",
".",
"_iconsWidth",
";",
"if",
"(",
"newValue",
"<",
"0",
")",
"{",
"newValue",
"=",
"0",
";",
"}",
"}",
"if",
"(",
"this",
".",
"_frameWidth",
"!==",
"newValue",
")",
"{",
"this",
".",
"_frameWidth",
"=",
"newValue",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
]
| Updates the value of this._frameWidth, based on the value of this._outerWidth and this._iconsWidth.
@return {Boolean} true if the frame width changed
@protected | [
"Updates",
"the",
"value",
"of",
"this",
".",
"_frameWidth",
"based",
"on",
"the",
"value",
"of",
"this",
".",
"_outerWidth",
"and",
"this",
".",
"_iconsWidth",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L334-L350 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function (icon, param) {
var stateObject = this.getStateObject();
var iconParts = stateObject.icons[icon].split(":");
var iconInfo = ariaWidgetsAriaSkinInterface.getIcon(iconParts[0], iconParts[1]);
var active = stateObject.icons[icon + "IsActive"];
if (iconInfo) {
this._icons[icon].iconInfo = iconInfo;
this._icons[icon].active = active;
if (active) {
this._icons[icon].tooltip = this._tooltipLabels[param.activeIconIndex++];
}
param.width += iconInfo.width + (iconInfo.borderLeft || 0) + (iconInfo.borderRight || 0);
} else {
this.$logError(this.ICON_NOT_FOUND, icon);
}
} | javascript | function (icon, param) {
var stateObject = this.getStateObject();
var iconParts = stateObject.icons[icon].split(":");
var iconInfo = ariaWidgetsAriaSkinInterface.getIcon(iconParts[0], iconParts[1]);
var active = stateObject.icons[icon + "IsActive"];
if (iconInfo) {
this._icons[icon].iconInfo = iconInfo;
this._icons[icon].active = active;
if (active) {
this._icons[icon].tooltip = this._tooltipLabels[param.activeIconIndex++];
}
param.width += iconInfo.width + (iconInfo.borderLeft || 0) + (iconInfo.borderRight || 0);
} else {
this.$logError(this.ICON_NOT_FOUND, icon);
}
} | [
"function",
"(",
"icon",
",",
"param",
")",
"{",
"var",
"stateObject",
"=",
"this",
".",
"getStateObject",
"(",
")",
";",
"var",
"iconParts",
"=",
"stateObject",
".",
"icons",
"[",
"icon",
"]",
".",
"split",
"(",
"\":\"",
")",
";",
"var",
"iconInfo",
"=",
"ariaWidgetsAriaSkinInterface",
".",
"getIcon",
"(",
"iconParts",
"[",
"0",
"]",
",",
"iconParts",
"[",
"1",
"]",
")",
";",
"var",
"active",
"=",
"stateObject",
".",
"icons",
"[",
"icon",
"+",
"\"IsActive\"",
"]",
";",
"if",
"(",
"iconInfo",
")",
"{",
"this",
".",
"_icons",
"[",
"icon",
"]",
".",
"iconInfo",
"=",
"iconInfo",
";",
"this",
".",
"_icons",
"[",
"icon",
"]",
".",
"active",
"=",
"active",
";",
"if",
"(",
"active",
")",
"{",
"this",
".",
"_icons",
"[",
"icon",
"]",
".",
"tooltip",
"=",
"this",
".",
"_tooltipLabels",
"[",
"param",
".",
"activeIconIndex",
"++",
"]",
";",
"}",
"param",
".",
"width",
"+=",
"iconInfo",
".",
"width",
"+",
"(",
"iconInfo",
".",
"borderLeft",
"||",
"0",
")",
"+",
"(",
"iconInfo",
".",
"borderRight",
"||",
"0",
")",
";",
"}",
"else",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"ICON_NOT_FOUND",
",",
"icon",
")",
";",
"}",
"}"
]
| Compute the size of the given icon, after updating its iconInfo property based on the current state.
@protected | [
"Compute",
"the",
"size",
"of",
"the",
"given",
"icon",
"after",
"updating",
"its",
"iconInfo",
"property",
"based",
"on",
"the",
"current",
"state",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L356-L371 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function (iconInfo, active) {
// TODO: mutualize with the icon widget
var style = ['padding:0;display:inline-block;background-position:-', iconInfo.iconLeft, 'px -',
iconInfo.iconTop, 'px;width:', iconInfo.width, 'px;height:', iconInfo.height,
'px;vertical-align: top;'];
if (active) {
style.push('cursor:pointer;');
}
return style.join('');
} | javascript | function (iconInfo, active) {
// TODO: mutualize with the icon widget
var style = ['padding:0;display:inline-block;background-position:-', iconInfo.iconLeft, 'px -',
iconInfo.iconTop, 'px;width:', iconInfo.width, 'px;height:', iconInfo.height,
'px;vertical-align: top;'];
if (active) {
style.push('cursor:pointer;');
}
return style.join('');
} | [
"function",
"(",
"iconInfo",
",",
"active",
")",
"{",
"var",
"style",
"=",
"[",
"'padding:0;display:inline-block;background-position:-'",
",",
"iconInfo",
".",
"iconLeft",
",",
"'px -'",
",",
"iconInfo",
".",
"iconTop",
",",
"'px;width:'",
",",
"iconInfo",
".",
"width",
",",
"'px;height:'",
",",
"iconInfo",
".",
"height",
",",
"'px;vertical-align: top;'",
"]",
";",
"if",
"(",
"active",
")",
"{",
"style",
".",
"push",
"(",
"'cursor:pointer;'",
")",
";",
"}",
"return",
"style",
".",
"join",
"(",
"''",
")",
";",
"}"
]
| Return icon style as a string
@protected
@param {Object} iconInfo
@param {Boolean} active
@return {String} | [
"Return",
"icon",
"style",
"as",
"a",
"string"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L430-L439 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/frames/FrameWithIcons.js | function (event, iconName) {
var eventType = event.type;
if (eventType == "safetap" && !registerSafeTap(event)) {
// $SafeTap does not load the SafeTap class on non-touch devices
// however, that class may be loaded for any other reason, in which case
// we can receive safetap events but then registerSafeTap returns false
// and we can ignore the safetap event (as there will be also a click event)
return;
}
var eventName = this.eventMap[eventType];
if (eventName) {
this.$raiseEvent({
name : eventName,
iconName : iconName,
event: event
});
}
} | javascript | function (event, iconName) {
var eventType = event.type;
if (eventType == "safetap" && !registerSafeTap(event)) {
// $SafeTap does not load the SafeTap class on non-touch devices
// however, that class may be loaded for any other reason, in which case
// we can receive safetap events but then registerSafeTap returns false
// and we can ignore the safetap event (as there will be also a click event)
return;
}
var eventName = this.eventMap[eventType];
if (eventName) {
this.$raiseEvent({
name : eventName,
iconName : iconName,
event: event
});
}
} | [
"function",
"(",
"event",
",",
"iconName",
")",
"{",
"var",
"eventType",
"=",
"event",
".",
"type",
";",
"if",
"(",
"eventType",
"==",
"\"safetap\"",
"&&",
"!",
"registerSafeTap",
"(",
"event",
")",
")",
"{",
"return",
";",
"}",
"var",
"eventName",
"=",
"this",
".",
"eventMap",
"[",
"eventType",
"]",
";",
"if",
"(",
"eventName",
")",
"{",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"eventName",
",",
"iconName",
":",
"iconName",
",",
"event",
":",
"event",
"}",
")",
";",
"}",
"}"
]
| Delegate Icon event
@param {aria.DomEvent} event
@param {String} iconName | [
"Delegate",
"Icon",
"event"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/frames/FrameWithIcons.js#L493-L510 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Bridge.js | function (config, options) {
if (this._subWindow) {
if (this._subWindow.closed) {
// we probably did not catch correctly the unload event
this.close();
} else {
// TODO: log error
return;
}
}
var skinPath = config.skinPath;
if (!skinPath && !(aria.widgets && aria.widgets.AriaSkin)) {
var frameworkHref = ariaUtilsFrameATLoader.getFrameworkHref();
var urlMatch = /aria\/aria-?templates-([^\/]+)\.js/.exec(frameworkHref);
if (urlMatch && urlMatch.length > 1) {
skinPath = ariaCoreDownloadMgr.resolveURL("aria/css/atskin-" + urlMatch[1] + ".js", true);
} else if (/aria\/bootstrap.js/.test(frameworkHref)) {
skinPath = ariaCoreDownloadMgr.resolveURL("aria/css/atskin.js", true);
} else {
return;
}
}
// default options
if (!options) {
options = "width=1024, height=800";
}
// create sub window. Use date to create a new one each time
this._subWindow = Aria.$frameworkWindow.open("", config.title + ("" + (new Date()).getTime()), options);
// this is for creating the same window (usefull for debugging)
//this._subWindow = Aria.$frameworkWindow.open("", config.title, options);
// The _subWindow can be null if the popup blocker is enabled in the browser
if (this._subWindow == null) {
return;
}
this._config = config;
ariaUtilsAriaWindow.attachWindow();
ariaUtilsAriaWindow.$on({
"unloadWindow" : this._onMainWindowUnload,
scope : this
});
ariaUtilsFrameATLoader.loadAriaTemplatesInFrame(this._subWindow, {
fn: this._onFrameLoaded,
scope: this
}, {
crossDomain: true,
skipSkinCopy: !!skinPath,
extraScripts: skinPath ? [skinPath] : [],
keepLoadingIndicator: true,
onBeforeLoadingAria: {
fn: this._registerOnPopupUnload,
scope: this
}
});
} | javascript | function (config, options) {
if (this._subWindow) {
if (this._subWindow.closed) {
// we probably did not catch correctly the unload event
this.close();
} else {
// TODO: log error
return;
}
}
var skinPath = config.skinPath;
if (!skinPath && !(aria.widgets && aria.widgets.AriaSkin)) {
var frameworkHref = ariaUtilsFrameATLoader.getFrameworkHref();
var urlMatch = /aria\/aria-?templates-([^\/]+)\.js/.exec(frameworkHref);
if (urlMatch && urlMatch.length > 1) {
skinPath = ariaCoreDownloadMgr.resolveURL("aria/css/atskin-" + urlMatch[1] + ".js", true);
} else if (/aria\/bootstrap.js/.test(frameworkHref)) {
skinPath = ariaCoreDownloadMgr.resolveURL("aria/css/atskin.js", true);
} else {
return;
}
}
// default options
if (!options) {
options = "width=1024, height=800";
}
// create sub window. Use date to create a new one each time
this._subWindow = Aria.$frameworkWindow.open("", config.title + ("" + (new Date()).getTime()), options);
// this is for creating the same window (usefull for debugging)
//this._subWindow = Aria.$frameworkWindow.open("", config.title, options);
// The _subWindow can be null if the popup blocker is enabled in the browser
if (this._subWindow == null) {
return;
}
this._config = config;
ariaUtilsAriaWindow.attachWindow();
ariaUtilsAriaWindow.$on({
"unloadWindow" : this._onMainWindowUnload,
scope : this
});
ariaUtilsFrameATLoader.loadAriaTemplatesInFrame(this._subWindow, {
fn: this._onFrameLoaded,
scope: this
}, {
crossDomain: true,
skipSkinCopy: !!skinPath,
extraScripts: skinPath ? [skinPath] : [],
keepLoadingIndicator: true,
onBeforeLoadingAria: {
fn: this._registerOnPopupUnload,
scope: this
}
});
} | [
"function",
"(",
"config",
",",
"options",
")",
"{",
"if",
"(",
"this",
".",
"_subWindow",
")",
"{",
"if",
"(",
"this",
".",
"_subWindow",
".",
"closed",
")",
"{",
"this",
".",
"close",
"(",
")",
";",
"}",
"else",
"{",
"return",
";",
"}",
"}",
"var",
"skinPath",
"=",
"config",
".",
"skinPath",
";",
"if",
"(",
"!",
"skinPath",
"&&",
"!",
"(",
"aria",
".",
"widgets",
"&&",
"aria",
".",
"widgets",
".",
"AriaSkin",
")",
")",
"{",
"var",
"frameworkHref",
"=",
"ariaUtilsFrameATLoader",
".",
"getFrameworkHref",
"(",
")",
";",
"var",
"urlMatch",
"=",
"/",
"aria\\/aria-?templates-([^\\/]+)\\.js",
"/",
".",
"exec",
"(",
"frameworkHref",
")",
";",
"if",
"(",
"urlMatch",
"&&",
"urlMatch",
".",
"length",
">",
"1",
")",
"{",
"skinPath",
"=",
"ariaCoreDownloadMgr",
".",
"resolveURL",
"(",
"\"aria/css/atskin-\"",
"+",
"urlMatch",
"[",
"1",
"]",
"+",
"\".js\"",
",",
"true",
")",
";",
"}",
"else",
"if",
"(",
"/",
"aria\\/bootstrap.js",
"/",
".",
"test",
"(",
"frameworkHref",
")",
")",
"{",
"skinPath",
"=",
"ariaCoreDownloadMgr",
".",
"resolveURL",
"(",
"\"aria/css/atskin.js\"",
",",
"true",
")",
";",
"}",
"else",
"{",
"return",
";",
"}",
"}",
"if",
"(",
"!",
"options",
")",
"{",
"options",
"=",
"\"width=1024, height=800\"",
";",
"}",
"this",
".",
"_subWindow",
"=",
"Aria",
".",
"$frameworkWindow",
".",
"open",
"(",
"\"\"",
",",
"config",
".",
"title",
"+",
"(",
"\"\"",
"+",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
")",
",",
"options",
")",
";",
"if",
"(",
"this",
".",
"_subWindow",
"==",
"null",
")",
"{",
"return",
";",
"}",
"this",
".",
"_config",
"=",
"config",
";",
"ariaUtilsAriaWindow",
".",
"attachWindow",
"(",
")",
";",
"ariaUtilsAriaWindow",
".",
"$on",
"(",
"{",
"\"unloadWindow\"",
":",
"this",
".",
"_onMainWindowUnload",
",",
"scope",
":",
"this",
"}",
")",
";",
"ariaUtilsFrameATLoader",
".",
"loadAriaTemplatesInFrame",
"(",
"this",
".",
"_subWindow",
",",
"{",
"fn",
":",
"this",
".",
"_onFrameLoaded",
",",
"scope",
":",
"this",
"}",
",",
"{",
"crossDomain",
":",
"true",
",",
"skipSkinCopy",
":",
"!",
"!",
"skinPath",
",",
"extraScripts",
":",
"skinPath",
"?",
"[",
"skinPath",
"]",
":",
"[",
"]",
",",
"keepLoadingIndicator",
":",
"true",
",",
"onBeforeLoadingAria",
":",
"{",
"fn",
":",
"this",
".",
"_registerOnPopupUnload",
",",
"scope",
":",
"this",
"}",
"}",
")",
";",
"}"
]
| Create external display with given module controller classpath
@param {Object} config moduleControllerClasspath, displayClasspath, skinPath and title
@param {String} options for opening the subwindow. Default is "width=1024, height=800" | [
"Create",
"external",
"display",
"with",
"given",
"module",
"controller",
"classpath"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Bridge.js#L90-L149 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Bridge.js | function () {
// start working in subwindow
var Aria = this._subWindow.Aria, aria = this._subWindow.aria;
// link the url map and the root map in the sub-window
// to the corresponding maps in the main window:
Aria.rootFolderPath = this.getAria().rootFolderPath;
aria.core.DownloadMgr._urlMap = ariaCoreDownloadMgr._urlMap;
aria.core.DownloadMgr._rootMap = ariaCoreDownloadMgr._rootMap;
Aria.setRootDim({
width : {
min : 16
},
height : {
min : 16
}
});
Aria.load({
classes : ['aria.templates.ModuleCtrlFactory'],
oncomplete : {
fn : this._templatesReady,
scope : this
}
});
} | javascript | function () {
// start working in subwindow
var Aria = this._subWindow.Aria, aria = this._subWindow.aria;
// link the url map and the root map in the sub-window
// to the corresponding maps in the main window:
Aria.rootFolderPath = this.getAria().rootFolderPath;
aria.core.DownloadMgr._urlMap = ariaCoreDownloadMgr._urlMap;
aria.core.DownloadMgr._rootMap = ariaCoreDownloadMgr._rootMap;
Aria.setRootDim({
width : {
min : 16
},
height : {
min : 16
}
});
Aria.load({
classes : ['aria.templates.ModuleCtrlFactory'],
oncomplete : {
fn : this._templatesReady,
scope : this
}
});
} | [
"function",
"(",
")",
"{",
"var",
"Aria",
"=",
"this",
".",
"_subWindow",
".",
"Aria",
",",
"aria",
"=",
"this",
".",
"_subWindow",
".",
"aria",
";",
"Aria",
".",
"rootFolderPath",
"=",
"this",
".",
"getAria",
"(",
")",
".",
"rootFolderPath",
";",
"aria",
".",
"core",
".",
"DownloadMgr",
".",
"_urlMap",
"=",
"ariaCoreDownloadMgr",
".",
"_urlMap",
";",
"aria",
".",
"core",
".",
"DownloadMgr",
".",
"_rootMap",
"=",
"ariaCoreDownloadMgr",
".",
"_rootMap",
";",
"Aria",
".",
"setRootDim",
"(",
"{",
"width",
":",
"{",
"min",
":",
"16",
"}",
",",
"height",
":",
"{",
"min",
":",
"16",
"}",
"}",
")",
";",
"Aria",
".",
"load",
"(",
"{",
"classes",
":",
"[",
"'aria.templates.ModuleCtrlFactory'",
"]",
",",
"oncomplete",
":",
"{",
"fn",
":",
"this",
".",
"_templatesReady",
",",
"scope",
":",
"this",
"}",
"}",
")",
";",
"}"
]
| Function called from the sub window to start the module | [
"Function",
"called",
"from",
"the",
"sub",
"window",
"to",
"start",
"the",
"module"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Bridge.js#L189-L212 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Bridge.js | function () {
// continue working in subwindow
// var Aria = this._subWindow.Aria;
var aria = this._subWindow.aria;
// creates module instance first to be able to dispose it when window close
var self = this;
aria.templates.ModuleCtrlFactory.createModuleCtrl({
classpath : this._config.moduleCtrlClasspath,
autoDispose : false,
initArgs : {
bridge : this
}
}, {
fn : function (res) {
// For some obscure reason on IE 9 only, it is needed to put
// this closure here in order to call _moduleLoaded with
// the right scope:
self._moduleLoaded(res);
},
scope : this
}, false);
} | javascript | function () {
// continue working in subwindow
// var Aria = this._subWindow.Aria;
var aria = this._subWindow.aria;
// creates module instance first to be able to dispose it when window close
var self = this;
aria.templates.ModuleCtrlFactory.createModuleCtrl({
classpath : this._config.moduleCtrlClasspath,
autoDispose : false,
initArgs : {
bridge : this
}
}, {
fn : function (res) {
// For some obscure reason on IE 9 only, it is needed to put
// this closure here in order to call _moduleLoaded with
// the right scope:
self._moduleLoaded(res);
},
scope : this
}, false);
} | [
"function",
"(",
")",
"{",
"var",
"aria",
"=",
"this",
".",
"_subWindow",
".",
"aria",
";",
"var",
"self",
"=",
"this",
";",
"aria",
".",
"templates",
".",
"ModuleCtrlFactory",
".",
"createModuleCtrl",
"(",
"{",
"classpath",
":",
"this",
".",
"_config",
".",
"moduleCtrlClasspath",
",",
"autoDispose",
":",
"false",
",",
"initArgs",
":",
"{",
"bridge",
":",
"this",
"}",
"}",
",",
"{",
"fn",
":",
"function",
"(",
"res",
")",
"{",
"self",
".",
"_moduleLoaded",
"(",
"res",
")",
";",
"}",
",",
"scope",
":",
"this",
"}",
",",
"false",
")",
";",
"}"
]
| Called when templates package is ready. It will create associated module.
@protected | [
"Called",
"when",
"templates",
"package",
"is",
"ready",
".",
"It",
"will",
"create",
"associated",
"module",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Bridge.js#L218-L239 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Bridge.js | function (moduleCtrlObject) {
// finish working in subwindow
var Aria = this._subWindow.Aria; // , aria = this._subWindow.aria;
var moduleCtrl = moduleCtrlObject.moduleCtrlPrivate;
Aria.loadTemplate({
classpath : this._config.displayClasspath,
div : 'main',
moduleCtrl : moduleCtrl,
width : {
min : 16
},
height : {
min : 16
}
}, {
fn : this._displayLoaded,
scope : this
});
this._moduleCtrlRef = moduleCtrl;
this.isOpen = true;
} | javascript | function (moduleCtrlObject) {
// finish working in subwindow
var Aria = this._subWindow.Aria; // , aria = this._subWindow.aria;
var moduleCtrl = moduleCtrlObject.moduleCtrlPrivate;
Aria.loadTemplate({
classpath : this._config.displayClasspath,
div : 'main',
moduleCtrl : moduleCtrl,
width : {
min : 16
},
height : {
min : 16
}
}, {
fn : this._displayLoaded,
scope : this
});
this._moduleCtrlRef = moduleCtrl;
this.isOpen = true;
} | [
"function",
"(",
"moduleCtrlObject",
")",
"{",
"var",
"Aria",
"=",
"this",
".",
"_subWindow",
".",
"Aria",
";",
"var",
"moduleCtrl",
"=",
"moduleCtrlObject",
".",
"moduleCtrlPrivate",
";",
"Aria",
".",
"loadTemplate",
"(",
"{",
"classpath",
":",
"this",
".",
"_config",
".",
"displayClasspath",
",",
"div",
":",
"'main'",
",",
"moduleCtrl",
":",
"moduleCtrl",
",",
"width",
":",
"{",
"min",
":",
"16",
"}",
",",
"height",
":",
"{",
"min",
":",
"16",
"}",
"}",
",",
"{",
"fn",
":",
"this",
".",
"_displayLoaded",
",",
"scope",
":",
"this",
"}",
")",
";",
"this",
".",
"_moduleCtrlRef",
"=",
"moduleCtrl",
";",
"this",
".",
"isOpen",
"=",
"true",
";",
"}"
]
| Callback when module source is loaded
@param {Object} moduleCtrl and moduleCtrlPrivate
@protected | [
"Callback",
"when",
"module",
"source",
"is",
"loaded"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Bridge.js#L246-L266 | train |
|
ariatemplates/ariatemplates | src/aria/utils/Bridge.js | function () {
var subWindow = this._subWindow;
if (subWindow) {
this._subWindow = null;
if (!subWindow.closed) {
if (this._rootTplCtxtRef) {
this._rootTplCtxtRef.$dispose();
}
if (this._moduleCtrlRef) {
this._moduleCtrlRef.$dispose();
}
subWindow.close();
}
this._moduleCtrlRef = null;
this._rootTplCtxtRef = null;
ariaUtilsAriaWindow.$unregisterListeners(this);
ariaUtilsAriaWindow.detachWindow();
this.isOpen = false;
}
} | javascript | function () {
var subWindow = this._subWindow;
if (subWindow) {
this._subWindow = null;
if (!subWindow.closed) {
if (this._rootTplCtxtRef) {
this._rootTplCtxtRef.$dispose();
}
if (this._moduleCtrlRef) {
this._moduleCtrlRef.$dispose();
}
subWindow.close();
}
this._moduleCtrlRef = null;
this._rootTplCtxtRef = null;
ariaUtilsAriaWindow.$unregisterListeners(this);
ariaUtilsAriaWindow.detachWindow();
this.isOpen = false;
}
} | [
"function",
"(",
")",
"{",
"var",
"subWindow",
"=",
"this",
".",
"_subWindow",
";",
"if",
"(",
"subWindow",
")",
"{",
"this",
".",
"_subWindow",
"=",
"null",
";",
"if",
"(",
"!",
"subWindow",
".",
"closed",
")",
"{",
"if",
"(",
"this",
".",
"_rootTplCtxtRef",
")",
"{",
"this",
".",
"_rootTplCtxtRef",
".",
"$dispose",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"_moduleCtrlRef",
")",
"{",
"this",
".",
"_moduleCtrlRef",
".",
"$dispose",
"(",
")",
";",
"}",
"subWindow",
".",
"close",
"(",
")",
";",
"}",
"this",
".",
"_moduleCtrlRef",
"=",
"null",
";",
"this",
".",
"_rootTplCtxtRef",
"=",
"null",
";",
"ariaUtilsAriaWindow",
".",
"$unregisterListeners",
"(",
"this",
")",
";",
"ariaUtilsAriaWindow",
".",
"detachWindow",
"(",
")",
";",
"this",
".",
"isOpen",
"=",
"false",
";",
"}",
"}"
]
| Close subwindow and restore environment | [
"Close",
"subwindow",
"and",
"restore",
"environment"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Bridge.js#L279-L300 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/CheckBox.js | function () {
var cfg = this._cfg;
return ariaCoreBrowser.isIE11 && cfg.waiAria && cfg.disabled && this._isChecked() && cfg._inputType === "checkbox";
} | javascript | function () {
var cfg = this._cfg;
return ariaCoreBrowser.isIE11 && cfg.waiAria && cfg.disabled && this._isChecked() && cfg._inputType === "checkbox";
} | [
"function",
"(",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"return",
"ariaCoreBrowser",
".",
"isIE11",
"&&",
"cfg",
".",
"waiAria",
"&&",
"cfg",
".",
"disabled",
"&&",
"this",
".",
"_isChecked",
"(",
")",
"&&",
"cfg",
".",
"_inputType",
"===",
"\"checkbox\"",
";",
"}"
]
| Returns true if it is needed to use the work-around for a bug in IE 11 with screen readers.
@param {Boolean} true if the work-around is needed | [
"Returns",
"true",
"if",
"it",
"is",
"needed",
"to",
"use",
"the",
"work",
"-",
"around",
"for",
"a",
"bug",
"in",
"IE",
"11",
"with",
"screen",
"readers",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/CheckBox.js#L103-L106 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/CheckBox.js | function (hasIds, visible) {
var cfg = this._cfg;
var waiAria = cfg.waiAria;
var markup = ['<input type="', cfg._inputType, '"', ' value="', cfg.value, '"'];
var checked = this._isChecked();
if (checked) {
markup.push(' checked');
}
markup.push(visible ? ' style="display:inline-block"' : ' class="xSROnly"');
if (hasIds) {
var inputName = this._inputName;
if (inputName) {
markup.push(' name="', inputName, '"');
}
if (Aria.testMode || waiAria) {
markup.push(' id="' + this._domId + '_input"');
}
if (waiAria) {
markup.push(this._getAriaLabelMarkup());
}
} else if (waiAria) {
markup.push(' aria-hidden="true"');
}
if (cfg.disabled) {
if (visible || !this._hasWaiWorkaroundMarkup) {
markup.push(' disabled');
} else /* if (!visible && this._hasWaiWorkaroundMarkup) */ {
// This is the work-around: using aria-disabled and omitting the disabled attribute
markup.push(' aria-disabled="true"');
// to prevent the widget from being focusable by tab, we use tabindex="-1":
markup.push(' tabindex="-1"');
}
} else {
markup.push(' tabindex="', this._calculateTabIndex(), '"');
}
markup.push('/>');
return markup.join('');
} | javascript | function (hasIds, visible) {
var cfg = this._cfg;
var waiAria = cfg.waiAria;
var markup = ['<input type="', cfg._inputType, '"', ' value="', cfg.value, '"'];
var checked = this._isChecked();
if (checked) {
markup.push(' checked');
}
markup.push(visible ? ' style="display:inline-block"' : ' class="xSROnly"');
if (hasIds) {
var inputName = this._inputName;
if (inputName) {
markup.push(' name="', inputName, '"');
}
if (Aria.testMode || waiAria) {
markup.push(' id="' + this._domId + '_input"');
}
if (waiAria) {
markup.push(this._getAriaLabelMarkup());
}
} else if (waiAria) {
markup.push(' aria-hidden="true"');
}
if (cfg.disabled) {
if (visible || !this._hasWaiWorkaroundMarkup) {
markup.push(' disabled');
} else /* if (!visible && this._hasWaiWorkaroundMarkup) */ {
// This is the work-around: using aria-disabled and omitting the disabled attribute
markup.push(' aria-disabled="true"');
// to prevent the widget from being focusable by tab, we use tabindex="-1":
markup.push(' tabindex="-1"');
}
} else {
markup.push(' tabindex="', this._calculateTabIndex(), '"');
}
markup.push('/>');
return markup.join('');
} | [
"function",
"(",
"hasIds",
",",
"visible",
")",
"{",
"var",
"cfg",
"=",
"this",
".",
"_cfg",
";",
"var",
"waiAria",
"=",
"cfg",
".",
"waiAria",
";",
"var",
"markup",
"=",
"[",
"'<input type=\"'",
",",
"cfg",
".",
"_inputType",
",",
"'\"'",
",",
"' value=\"'",
",",
"cfg",
".",
"value",
",",
"'\"'",
"]",
";",
"var",
"checked",
"=",
"this",
".",
"_isChecked",
"(",
")",
";",
"if",
"(",
"checked",
")",
"{",
"markup",
".",
"push",
"(",
"' checked'",
")",
";",
"}",
"markup",
".",
"push",
"(",
"visible",
"?",
"' style=\"display:inline-block\"'",
":",
"' class=\"xSROnly\"'",
")",
";",
"if",
"(",
"hasIds",
")",
"{",
"var",
"inputName",
"=",
"this",
".",
"_inputName",
";",
"if",
"(",
"inputName",
")",
"{",
"markup",
".",
"push",
"(",
"' name=\"'",
",",
"inputName",
",",
"'\"'",
")",
";",
"}",
"if",
"(",
"Aria",
".",
"testMode",
"||",
"waiAria",
")",
"{",
"markup",
".",
"push",
"(",
"' id=\"'",
"+",
"this",
".",
"_domId",
"+",
"'_input\"'",
")",
";",
"}",
"if",
"(",
"waiAria",
")",
"{",
"markup",
".",
"push",
"(",
"this",
".",
"_getAriaLabelMarkup",
"(",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"waiAria",
")",
"{",
"markup",
".",
"push",
"(",
"' aria-hidden=\"true\"'",
")",
";",
"}",
"if",
"(",
"cfg",
".",
"disabled",
")",
"{",
"if",
"(",
"visible",
"||",
"!",
"this",
".",
"_hasWaiWorkaroundMarkup",
")",
"{",
"markup",
".",
"push",
"(",
"' disabled'",
")",
";",
"}",
"else",
"{",
"markup",
".",
"push",
"(",
"' aria-disabled=\"true\"'",
")",
";",
"markup",
".",
"push",
"(",
"' tabindex=\"-1\"'",
")",
";",
"}",
"}",
"else",
"{",
"markup",
".",
"push",
"(",
"' tabindex=\"'",
",",
"this",
".",
"_calculateTabIndex",
"(",
")",
",",
"'\"'",
")",
";",
"}",
"markup",
".",
"push",
"(",
"'/>'",
")",
";",
"return",
"markup",
".",
"join",
"(",
"''",
")",
";",
"}"
]
| Returns the markup of an input element representing the current state of the widget.
@param {Boolean} hasIds Whether the input should have a name and ids (if configured so).
@param {Boolean} visible Whether the input should be visible (or have the xSROnly class)
@return {String} | [
"Returns",
"the",
"markup",
"of",
"an",
"input",
"element",
"representing",
"the",
"current",
"state",
"of",
"the",
"widget",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/CheckBox.js#L145-L182 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/CheckBox.js | function () {
var newState = this._state;
if (this._icon) {
this._icon.changeIcon(this._getIconName(newState));
}
var inpEl = this._getFocusableElement();
if (inpEl != null) {
var hasWaiWorkaroundMarkup = this._hasWaiWorkaroundMarkup;
var needWaiWorkaroundMarkup = this._needWaiWorkaroundMarkup();
if (hasWaiWorkaroundMarkup || needWaiWorkaroundMarkup) {
// Jaws has some issues with disabled check boxes
// (cf test.aria.widgets.wai.input.checkbox.CheckboxDisabledJawsTestCase)
if (this._hasTwoInputs) {
aria.utils.Dom.removeElement(inpEl.nextSibling);
}
var markup = this._getInputsMarkup();
aria.utils.Dom.insertAdjacentHTML(inpEl, "afterEnd", markup);
aria.utils.Dom.removeElement(inpEl);
this._initializeFocusableElement();
inpEl = this._getFocusableElement();
} else {
var disabled = this.getProperty("disabled");
var selected = this._isChecked();
inpEl.checked = selected;
inpEl.value = selected ? "true" : "false";
inpEl.disabled = disabled;
}
}
if (this._label != null) {
try {
// This call throws an exception when the color is 'inherit'
// and the browser or the browser mode is IE7
this._label.style.color = this._skinObj.states[newState].color;
} catch (ex) {
this._label.style.color = "";
}
}
} | javascript | function () {
var newState = this._state;
if (this._icon) {
this._icon.changeIcon(this._getIconName(newState));
}
var inpEl = this._getFocusableElement();
if (inpEl != null) {
var hasWaiWorkaroundMarkup = this._hasWaiWorkaroundMarkup;
var needWaiWorkaroundMarkup = this._needWaiWorkaroundMarkup();
if (hasWaiWorkaroundMarkup || needWaiWorkaroundMarkup) {
// Jaws has some issues with disabled check boxes
// (cf test.aria.widgets.wai.input.checkbox.CheckboxDisabledJawsTestCase)
if (this._hasTwoInputs) {
aria.utils.Dom.removeElement(inpEl.nextSibling);
}
var markup = this._getInputsMarkup();
aria.utils.Dom.insertAdjacentHTML(inpEl, "afterEnd", markup);
aria.utils.Dom.removeElement(inpEl);
this._initializeFocusableElement();
inpEl = this._getFocusableElement();
} else {
var disabled = this.getProperty("disabled");
var selected = this._isChecked();
inpEl.checked = selected;
inpEl.value = selected ? "true" : "false";
inpEl.disabled = disabled;
}
}
if (this._label != null) {
try {
// This call throws an exception when the color is 'inherit'
// and the browser or the browser mode is IE7
this._label.style.color = this._skinObj.states[newState].color;
} catch (ex) {
this._label.style.color = "";
}
}
} | [
"function",
"(",
")",
"{",
"var",
"newState",
"=",
"this",
".",
"_state",
";",
"if",
"(",
"this",
".",
"_icon",
")",
"{",
"this",
".",
"_icon",
".",
"changeIcon",
"(",
"this",
".",
"_getIconName",
"(",
"newState",
")",
")",
";",
"}",
"var",
"inpEl",
"=",
"this",
".",
"_getFocusableElement",
"(",
")",
";",
"if",
"(",
"inpEl",
"!=",
"null",
")",
"{",
"var",
"hasWaiWorkaroundMarkup",
"=",
"this",
".",
"_hasWaiWorkaroundMarkup",
";",
"var",
"needWaiWorkaroundMarkup",
"=",
"this",
".",
"_needWaiWorkaroundMarkup",
"(",
")",
";",
"if",
"(",
"hasWaiWorkaroundMarkup",
"||",
"needWaiWorkaroundMarkup",
")",
"{",
"if",
"(",
"this",
".",
"_hasTwoInputs",
")",
"{",
"aria",
".",
"utils",
".",
"Dom",
".",
"removeElement",
"(",
"inpEl",
".",
"nextSibling",
")",
";",
"}",
"var",
"markup",
"=",
"this",
".",
"_getInputsMarkup",
"(",
")",
";",
"aria",
".",
"utils",
".",
"Dom",
".",
"insertAdjacentHTML",
"(",
"inpEl",
",",
"\"afterEnd\"",
",",
"markup",
")",
";",
"aria",
".",
"utils",
".",
"Dom",
".",
"removeElement",
"(",
"inpEl",
")",
";",
"this",
".",
"_initializeFocusableElement",
"(",
")",
";",
"inpEl",
"=",
"this",
".",
"_getFocusableElement",
"(",
")",
";",
"}",
"else",
"{",
"var",
"disabled",
"=",
"this",
".",
"getProperty",
"(",
"\"disabled\"",
")",
";",
"var",
"selected",
"=",
"this",
".",
"_isChecked",
"(",
")",
";",
"inpEl",
".",
"checked",
"=",
"selected",
";",
"inpEl",
".",
"value",
"=",
"selected",
"?",
"\"true\"",
":",
"\"false\"",
";",
"inpEl",
".",
"disabled",
"=",
"disabled",
";",
"}",
"}",
"if",
"(",
"this",
".",
"_label",
"!=",
"null",
")",
"{",
"try",
"{",
"this",
".",
"_label",
".",
"style",
".",
"color",
"=",
"this",
".",
"_skinObj",
".",
"states",
"[",
"newState",
"]",
".",
"color",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"this",
".",
"_label",
".",
"style",
".",
"color",
"=",
"\"\"",
";",
"}",
"}",
"}"
]
| Internal method to change the state of the checkbox
@protected | [
"Internal",
"method",
"to",
"change",
"the",
"state",
"of",
"the",
"checkbox"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/CheckBox.js#L342-L384 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/CheckBox.js | function () {
var newValue = !this.getProperty("value");
this._cfg.value = newValue;
this.setProperty("value", newValue);
// setProperty on value might destroy the widget
if (this._cfg) {
this._setState();
this._updateDomForState();
var changeCallback = this._cfg.onchange;
if (changeCallback) {
this.evalCallback(changeCallback);
}
}
} | javascript | function () {
var newValue = !this.getProperty("value");
this._cfg.value = newValue;
this.setProperty("value", newValue);
// setProperty on value might destroy the widget
if (this._cfg) {
this._setState();
this._updateDomForState();
var changeCallback = this._cfg.onchange;
if (changeCallback) {
this.evalCallback(changeCallback);
}
}
} | [
"function",
"(",
")",
"{",
"var",
"newValue",
"=",
"!",
"this",
".",
"getProperty",
"(",
"\"value\"",
")",
";",
"this",
".",
"_cfg",
".",
"value",
"=",
"newValue",
";",
"this",
".",
"setProperty",
"(",
"\"value\"",
",",
"newValue",
")",
";",
"if",
"(",
"this",
".",
"_cfg",
")",
"{",
"this",
".",
"_setState",
"(",
")",
";",
"this",
".",
"_updateDomForState",
"(",
")",
";",
"var",
"changeCallback",
"=",
"this",
".",
"_cfg",
".",
"onchange",
";",
"if",
"(",
"changeCallback",
")",
"{",
"this",
".",
"evalCallback",
"(",
"changeCallback",
")",
";",
"}",
"}",
"}"
]
| Toggles the value of the checkbox and updates states, DOM etc. Typically called when user performs action
that toggles the value
@protected | [
"Toggles",
"the",
"value",
"of",
"the",
"checkbox",
"and",
"updates",
"states",
"DOM",
"etc",
".",
"Typically",
"called",
"when",
"user",
"performs",
"action",
"that",
"toggles",
"the",
"value"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/CheckBox.js#L433-L446 | train |
|
ariatemplates/ariatemplates | src/aria/html/DisabledTrait.js | function () {
var bindings = this._cfg.bind;
var binding = bindings.disabled;
if (binding) {
var newValue = this._transform(binding.transform, binding.inside[binding.to], "toWidget");
if (ariaUtilsType.isBoolean(newValue)) {
this._domElt.disabled = newValue;
} else {
ariaUtilsJson.setValue(binding.inside, binding.to, this._domElt.disabled);
}
}
} | javascript | function () {
var bindings = this._cfg.bind;
var binding = bindings.disabled;
if (binding) {
var newValue = this._transform(binding.transform, binding.inside[binding.to], "toWidget");
if (ariaUtilsType.isBoolean(newValue)) {
this._domElt.disabled = newValue;
} else {
ariaUtilsJson.setValue(binding.inside, binding.to, this._domElt.disabled);
}
}
} | [
"function",
"(",
")",
"{",
"var",
"bindings",
"=",
"this",
".",
"_cfg",
".",
"bind",
";",
"var",
"binding",
"=",
"bindings",
".",
"disabled",
";",
"if",
"(",
"binding",
")",
"{",
"var",
"newValue",
"=",
"this",
".",
"_transform",
"(",
"binding",
".",
"transform",
",",
"binding",
".",
"inside",
"[",
"binding",
".",
"to",
"]",
",",
"\"toWidget\"",
")",
";",
"if",
"(",
"ariaUtilsType",
".",
"isBoolean",
"(",
"newValue",
")",
")",
"{",
"this",
".",
"_domElt",
".",
"disabled",
"=",
"newValue",
";",
"}",
"else",
"{",
"ariaUtilsJson",
".",
"setValue",
"(",
"binding",
".",
"inside",
",",
"binding",
".",
"to",
",",
"this",
".",
"_domElt",
".",
"disabled",
")",
";",
"}",
"}",
"}"
]
| Initialize the disabled attribute of the widget by taking into account the data model to which it might be
bound. | [
"Initialize",
"the",
"disabled",
"attribute",
"of",
"the",
"widget",
"by",
"taking",
"into",
"account",
"the",
"data",
"model",
"to",
"which",
"it",
"might",
"be",
"bound",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/DisabledTrait.js#L31-L42 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (tree, optionsOrAllDeps, callback, context, debug, skipLogError) {
var options = normalizeOptions(optionsOrAllDeps, context, debug, skipLogError);
this.__buildClass(tree, options, callback);
} | javascript | function (tree, optionsOrAllDeps, callback, context, debug, skipLogError) {
var options = normalizeOptions(optionsOrAllDeps, context, debug, skipLogError);
this.__buildClass(tree, options, callback);
} | [
"function",
"(",
"tree",
",",
"optionsOrAllDeps",
",",
"callback",
",",
"context",
",",
"debug",
",",
"skipLogError",
")",
"{",
"var",
"options",
"=",
"normalizeOptions",
"(",
"optionsOrAllDeps",
",",
"context",
",",
"debug",
",",
"skipLogError",
")",
";",
"this",
".",
"__buildClass",
"(",
"tree",
",",
"options",
",",
"callback",
")",
";",
"}"
]
| Parse a debug template from the tree
@param {aria.templates.TreeBeans:Root} tree tree returned by the parser.
@param {aria.templates.CfgBeans:ClassGeneratorCfg} options Options for class generation.
@param {aria.core.CfgBeans:Callback} callback callback the callback description | [
"Parse",
"a",
"debug",
"template",
"from",
"the",
"tree"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L154-L157 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (statements) {
for (var i = 0, len = statements.length; i < len; i += 1) {
var statement = statements[i];
this.STATEMENTS[statement] = this.ALLSTATEMENTS[statement];
}
} | javascript | function (statements) {
for (var i = 0, len = statements.length; i < len; i += 1) {
var statement = statements[i];
this.STATEMENTS[statement] = this.ALLSTATEMENTS[statement];
}
} | [
"function",
"(",
"statements",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"statements",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"+=",
"1",
")",
"{",
"var",
"statement",
"=",
"statements",
"[",
"i",
"]",
";",
"this",
".",
"STATEMENTS",
"[",
"statement",
"]",
"=",
"this",
".",
"ALLSTATEMENTS",
"[",
"statement",
"]",
";",
"}",
"}"
]
| Load the list of statements that are allowed for this class generator. The list is specified by the
descendant class aria.templates.TplClassGenerator and aria.templates.CSSClassGenerator
@param {Array} statements List of statements name
@protected | [
"Load",
"the",
"list",
"of",
"statements",
"that",
"are",
"allowed",
"for",
"this",
"class",
"generator",
".",
"The",
"list",
"is",
"specified",
"by",
"the",
"descendant",
"class",
"aria",
".",
"templates",
".",
"TplClassGenerator",
"and",
"aria",
".",
"templates",
".",
"CSSClassGenerator"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L165-L170 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (tree, options, callback) {
ariaCoreJsonValidator.check(tree, "aria.templates.TreeBeans.Root");
var out = new ariaTemplatesClassWriter({
fn : this.__processStatement,
scope : this
}, options.skipLogError ? null : {
fn : this.__logError,
scope : this
});
out.errorContext = options.errorContext;
out.allDependencies = options.allDependencies;
out.callback = callback;
out.tree = tree;
out.debug = (options.debug === true);
out.dontLoadWidgetLibs = (options.dontLoadWidgetLibs === true);
if (options.parseOnly) {
out.enableParseOnly();
}
this._processRootStatement(out, tree);
if (out.errors) {
out.$dispose();
this.$callback(callback, {
errors : out.errors,
classDef : null
});
}
} | javascript | function (tree, options, callback) {
ariaCoreJsonValidator.check(tree, "aria.templates.TreeBeans.Root");
var out = new ariaTemplatesClassWriter({
fn : this.__processStatement,
scope : this
}, options.skipLogError ? null : {
fn : this.__logError,
scope : this
});
out.errorContext = options.errorContext;
out.allDependencies = options.allDependencies;
out.callback = callback;
out.tree = tree;
out.debug = (options.debug === true);
out.dontLoadWidgetLibs = (options.dontLoadWidgetLibs === true);
if (options.parseOnly) {
out.enableParseOnly();
}
this._processRootStatement(out, tree);
if (out.errors) {
out.$dispose();
this.$callback(callback, {
errors : out.errors,
classDef : null
});
}
} | [
"function",
"(",
"tree",
",",
"options",
",",
"callback",
")",
"{",
"ariaCoreJsonValidator",
".",
"check",
"(",
"tree",
",",
"\"aria.templates.TreeBeans.Root\"",
")",
";",
"var",
"out",
"=",
"new",
"ariaTemplatesClassWriter",
"(",
"{",
"fn",
":",
"this",
".",
"__processStatement",
",",
"scope",
":",
"this",
"}",
",",
"options",
".",
"skipLogError",
"?",
"null",
":",
"{",
"fn",
":",
"this",
".",
"__logError",
",",
"scope",
":",
"this",
"}",
")",
";",
"out",
".",
"errorContext",
"=",
"options",
".",
"errorContext",
";",
"out",
".",
"allDependencies",
"=",
"options",
".",
"allDependencies",
";",
"out",
".",
"callback",
"=",
"callback",
";",
"out",
".",
"tree",
"=",
"tree",
";",
"out",
".",
"debug",
"=",
"(",
"options",
".",
"debug",
"===",
"true",
")",
";",
"out",
".",
"dontLoadWidgetLibs",
"=",
"(",
"options",
".",
"dontLoadWidgetLibs",
"===",
"true",
")",
";",
"if",
"(",
"options",
".",
"parseOnly",
")",
"{",
"out",
".",
"enableParseOnly",
"(",
")",
";",
"}",
"this",
".",
"_processRootStatement",
"(",
"out",
",",
"tree",
")",
";",
"if",
"(",
"out",
".",
"errors",
")",
"{",
"out",
".",
"$dispose",
"(",
")",
";",
"this",
".",
"$callback",
"(",
"callback",
",",
"{",
"errors",
":",
"out",
".",
"errors",
",",
"classDef",
":",
"null",
"}",
")",
";",
"}",
"}"
]
| Build the template class from the tree given by the parser.
@private
@param {aria.templates.TreeBeans:Root} tree tree returned by the parser.
@param {aria.templates.CfgBeans:ClassGeneratorCfg} options Options for class generation.
@param {aria.core.CfgBeans:Callback} callback the callback description | [
"Build",
"the",
"template",
"class",
"from",
"the",
"tree",
"given",
"by",
"the",
"parser",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L187-L214 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out, tree) {
var rootStatement = tree.content[0];
if (tree.content.length != 1 || (rootStatement.name != this._rootStatement)) {
return out.logError(tree, this.TEMPLATE_STATEMENT_EXPECTED, [this._rootStatement]);
}
if (rootStatement.content == null) {
return out.logError(rootStatement, this.EXPECTED_CONTAINER, [this._rootStatement]);
}
var param;
try {
// The parameter should be a JSON object
param = Aria["eval"]("return (" + rootStatement.paramBlock + ");");
} catch (e) {
return out.logError(rootStatement, this.ERROR_IN_TEMPLATE_PARAMETER, [this._rootStatement], e);
}
if (!ariaCoreJsonValidator.normalize({
json : param,
beanName : this._templateParamBean
})) {
return out.logError(rootStatement, this.CHECK_ERROR_IN_TEMPLATE_PARAMETER, [this._rootStatement]);
}
out.templateParam = param;
rootStatement.properties = param;
this._processTemplateContent({
out : out,
statement : rootStatement
});
} | javascript | function (out, tree) {
var rootStatement = tree.content[0];
if (tree.content.length != 1 || (rootStatement.name != this._rootStatement)) {
return out.logError(tree, this.TEMPLATE_STATEMENT_EXPECTED, [this._rootStatement]);
}
if (rootStatement.content == null) {
return out.logError(rootStatement, this.EXPECTED_CONTAINER, [this._rootStatement]);
}
var param;
try {
// The parameter should be a JSON object
param = Aria["eval"]("return (" + rootStatement.paramBlock + ");");
} catch (e) {
return out.logError(rootStatement, this.ERROR_IN_TEMPLATE_PARAMETER, [this._rootStatement], e);
}
if (!ariaCoreJsonValidator.normalize({
json : param,
beanName : this._templateParamBean
})) {
return out.logError(rootStatement, this.CHECK_ERROR_IN_TEMPLATE_PARAMETER, [this._rootStatement]);
}
out.templateParam = param;
rootStatement.properties = param;
this._processTemplateContent({
out : out,
statement : rootStatement
});
} | [
"function",
"(",
"out",
",",
"tree",
")",
"{",
"var",
"rootStatement",
"=",
"tree",
".",
"content",
"[",
"0",
"]",
";",
"if",
"(",
"tree",
".",
"content",
".",
"length",
"!=",
"1",
"||",
"(",
"rootStatement",
".",
"name",
"!=",
"this",
".",
"_rootStatement",
")",
")",
"{",
"return",
"out",
".",
"logError",
"(",
"tree",
",",
"this",
".",
"TEMPLATE_STATEMENT_EXPECTED",
",",
"[",
"this",
".",
"_rootStatement",
"]",
")",
";",
"}",
"if",
"(",
"rootStatement",
".",
"content",
"==",
"null",
")",
"{",
"return",
"out",
".",
"logError",
"(",
"rootStatement",
",",
"this",
".",
"EXPECTED_CONTAINER",
",",
"[",
"this",
".",
"_rootStatement",
"]",
")",
";",
"}",
"var",
"param",
";",
"try",
"{",
"param",
"=",
"Aria",
"[",
"\"eval\"",
"]",
"(",
"\"return (\"",
"+",
"rootStatement",
".",
"paramBlock",
"+",
"\");\"",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"out",
".",
"logError",
"(",
"rootStatement",
",",
"this",
".",
"ERROR_IN_TEMPLATE_PARAMETER",
",",
"[",
"this",
".",
"_rootStatement",
"]",
",",
"e",
")",
";",
"}",
"if",
"(",
"!",
"ariaCoreJsonValidator",
".",
"normalize",
"(",
"{",
"json",
":",
"param",
",",
"beanName",
":",
"this",
".",
"_templateParamBean",
"}",
")",
")",
"{",
"return",
"out",
".",
"logError",
"(",
"rootStatement",
",",
"this",
".",
"CHECK_ERROR_IN_TEMPLATE_PARAMETER",
",",
"[",
"this",
".",
"_rootStatement",
"]",
")",
";",
"}",
"out",
".",
"templateParam",
"=",
"param",
";",
"rootStatement",
".",
"properties",
"=",
"param",
";",
"this",
".",
"_processTemplateContent",
"(",
"{",
"out",
":",
"out",
",",
"statement",
":",
"rootStatement",
"}",
")",
";",
"}"
]
| Process the root statement of the template.
@param {aria.templates.ClassWriter} out
@param {aria.templates.TreeBeans:Statement} tree
@protected | [
"Process",
"the",
"root",
"statement",
"of",
"the",
"template",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L222-L251 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out, statement) {
var statname = statement.name;
if (statname.charAt(0) == '@') {
statname = '@';
}
var handler = this.STATEMENTS[statname];
if (handler == null) {
out.logError(statement, this.UNKNOWN_STATEMENT, [statname]);
} else if (handler.container === true && statement.content === undefined) {
out.logError(statement, this.EXPECTED_CONTAINER, [statname]);
} else if (handler.container === false && statement.content !== undefined) {
out.logError(statement, this.UNEXPECTED_CONTAINER, [statname]);
} else if (handler.inMacro !== undefined && out.isOutputReady() !== handler.inMacro) {
if (handler.inMacro) {
out.logError(statement, ariaTemplatesStatements.SHOULD_BE_IN_MACRO, [statname]);
} else {
out.logError(statement, this.SHOULD_BE_OUT_OF_MACRO, [statname]);
}
} else {
if (handler.paramRegexp) {
var res = handler.paramRegexp.exec(statement.paramBlock);
if (res == null) {
out.logError(statement, this.INVALID_STATEMENT_SYNTAX, [statname, handler.paramRegexp]);
} else {
if (this._isDebug) {
out.trackLine(statement.lineNumber);
}
handler.process(out, statement, res);
}
} else {
if (this._isDebug) {
out.trackLine(statement.lineNumber);
}
handler.process(out, statement, this);
}
}
} | javascript | function (out, statement) {
var statname = statement.name;
if (statname.charAt(0) == '@') {
statname = '@';
}
var handler = this.STATEMENTS[statname];
if (handler == null) {
out.logError(statement, this.UNKNOWN_STATEMENT, [statname]);
} else if (handler.container === true && statement.content === undefined) {
out.logError(statement, this.EXPECTED_CONTAINER, [statname]);
} else if (handler.container === false && statement.content !== undefined) {
out.logError(statement, this.UNEXPECTED_CONTAINER, [statname]);
} else if (handler.inMacro !== undefined && out.isOutputReady() !== handler.inMacro) {
if (handler.inMacro) {
out.logError(statement, ariaTemplatesStatements.SHOULD_BE_IN_MACRO, [statname]);
} else {
out.logError(statement, this.SHOULD_BE_OUT_OF_MACRO, [statname]);
}
} else {
if (handler.paramRegexp) {
var res = handler.paramRegexp.exec(statement.paramBlock);
if (res == null) {
out.logError(statement, this.INVALID_STATEMENT_SYNTAX, [statname, handler.paramRegexp]);
} else {
if (this._isDebug) {
out.trackLine(statement.lineNumber);
}
handler.process(out, statement, res);
}
} else {
if (this._isDebug) {
out.trackLine(statement.lineNumber);
}
handler.process(out, statement, this);
}
}
} | [
"function",
"(",
"out",
",",
"statement",
")",
"{",
"var",
"statname",
"=",
"statement",
".",
"name",
";",
"if",
"(",
"statname",
".",
"charAt",
"(",
"0",
")",
"==",
"'@'",
")",
"{",
"statname",
"=",
"'@'",
";",
"}",
"var",
"handler",
"=",
"this",
".",
"STATEMENTS",
"[",
"statname",
"]",
";",
"if",
"(",
"handler",
"==",
"null",
")",
"{",
"out",
".",
"logError",
"(",
"statement",
",",
"this",
".",
"UNKNOWN_STATEMENT",
",",
"[",
"statname",
"]",
")",
";",
"}",
"else",
"if",
"(",
"handler",
".",
"container",
"===",
"true",
"&&",
"statement",
".",
"content",
"===",
"undefined",
")",
"{",
"out",
".",
"logError",
"(",
"statement",
",",
"this",
".",
"EXPECTED_CONTAINER",
",",
"[",
"statname",
"]",
")",
";",
"}",
"else",
"if",
"(",
"handler",
".",
"container",
"===",
"false",
"&&",
"statement",
".",
"content",
"!==",
"undefined",
")",
"{",
"out",
".",
"logError",
"(",
"statement",
",",
"this",
".",
"UNEXPECTED_CONTAINER",
",",
"[",
"statname",
"]",
")",
";",
"}",
"else",
"if",
"(",
"handler",
".",
"inMacro",
"!==",
"undefined",
"&&",
"out",
".",
"isOutputReady",
"(",
")",
"!==",
"handler",
".",
"inMacro",
")",
"{",
"if",
"(",
"handler",
".",
"inMacro",
")",
"{",
"out",
".",
"logError",
"(",
"statement",
",",
"ariaTemplatesStatements",
".",
"SHOULD_BE_IN_MACRO",
",",
"[",
"statname",
"]",
")",
";",
"}",
"else",
"{",
"out",
".",
"logError",
"(",
"statement",
",",
"this",
".",
"SHOULD_BE_OUT_OF_MACRO",
",",
"[",
"statname",
"]",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"handler",
".",
"paramRegexp",
")",
"{",
"var",
"res",
"=",
"handler",
".",
"paramRegexp",
".",
"exec",
"(",
"statement",
".",
"paramBlock",
")",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"out",
".",
"logError",
"(",
"statement",
",",
"this",
".",
"INVALID_STATEMENT_SYNTAX",
",",
"[",
"statname",
",",
"handler",
".",
"paramRegexp",
"]",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"_isDebug",
")",
"{",
"out",
".",
"trackLine",
"(",
"statement",
".",
"lineNumber",
")",
";",
"}",
"handler",
".",
"process",
"(",
"out",
",",
"statement",
",",
"res",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"_isDebug",
")",
"{",
"out",
".",
"trackLine",
"(",
"statement",
".",
"lineNumber",
")",
";",
"}",
"handler",
".",
"process",
"(",
"out",
",",
"statement",
",",
"this",
")",
";",
"}",
"}",
"}"
]
| This method is called for each statement to produce an output in the class definition. It propagates the call
to the correct process function in this.STATEMENTS, or logs errors, if the statement is unknown, or misused.
@private
@param {aria.templates.ClassWriter} out
@param {aria.templates.TreeBeans:Statement} statement | [
"This",
"method",
"is",
"called",
"for",
"each",
"statement",
"to",
"produce",
"an",
"output",
"in",
"the",
"class",
"definition",
".",
"It",
"propagates",
"the",
"call",
"to",
"the",
"correct",
"process",
"function",
"in",
"this",
".",
"STATEMENTS",
"or",
"logs",
"errors",
"if",
"the",
"statement",
"is",
"unknown",
"or",
"misused",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L260-L297 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (statement, msgId, msgArgs, errorContext) {
if (msgArgs == null) {
msgArgs = [];
}
msgArgs.push(statement.lineNumber);
this.$logError(msgId, msgArgs, errorContext);
} | javascript | function (statement, msgId, msgArgs, errorContext) {
if (msgArgs == null) {
msgArgs = [];
}
msgArgs.push(statement.lineNumber);
this.$logError(msgId, msgArgs, errorContext);
} | [
"function",
"(",
"statement",
",",
"msgId",
",",
"msgArgs",
",",
"errorContext",
")",
"{",
"if",
"(",
"msgArgs",
"==",
"null",
")",
"{",
"msgArgs",
"=",
"[",
"]",
";",
"}",
"msgArgs",
".",
"push",
"(",
"statement",
".",
"lineNumber",
")",
";",
"this",
".",
"$logError",
"(",
"msgId",
",",
"msgArgs",
",",
"errorContext",
")",
";",
"}"
]
| Log the given error.
@private
@param {aria.templates.TreeBeans:Statement} statement Statement in the template tree from which the error is
being raised. It will be transformed into the corresponding line number in the source template and added at
the end of otherParams.
@param {String} msgId error id, used to find the error message
@param {Array} msgArgs parameters of the error message
@param {Object} errorContext | [
"Log",
"the",
"given",
"error",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L309-L315 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out) {
out.newBlock("main", 0);
out.newBlock("classDefinition", 0);
out.newBlock("prototype", 2);
out.newBlock("globalVars", 5);
out.newBlock("initTemplate", 3);
out.newBlock("classInit", 3);
} | javascript | function (out) {
out.newBlock("main", 0);
out.newBlock("classDefinition", 0);
out.newBlock("prototype", 2);
out.newBlock("globalVars", 5);
out.newBlock("initTemplate", 3);
out.newBlock("classInit", 3);
} | [
"function",
"(",
"out",
")",
"{",
"out",
".",
"newBlock",
"(",
"\"main\"",
",",
"0",
")",
";",
"out",
".",
"newBlock",
"(",
"\"classDefinition\"",
",",
"0",
")",
";",
"out",
".",
"newBlock",
"(",
"\"prototype\"",
",",
"2",
")",
";",
"out",
".",
"newBlock",
"(",
"\"globalVars\"",
",",
"5",
")",
";",
"out",
".",
"newBlock",
"(",
"\"initTemplate\"",
",",
"3",
")",
";",
"out",
".",
"newBlock",
"(",
"\"classInit\"",
",",
"3",
")",
";",
"}"
]
| Create the required blocks in the class writer.
@param {aria.templates.ClassWriter} out
@protected | [
"Create",
"the",
"required",
"blocks",
"in",
"the",
"class",
"writer",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L322-L329 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out) {
var tplParam = out.templateParam;
out.writeln("module.exports = Aria.classDefinition({");
out.increaseIndent();
out.writeln("$classpath: ", out.stringify(tplParam.$classpath), ",");
if (out.parentClasspath) {
out.writeln("$extends: require(", out.stringify(Aria.getLogicalPath(out.parentClasspath, Aria.ACCEPTED_TYPES[out.parentClassType])), "),");
}
} | javascript | function (out) {
var tplParam = out.templateParam;
out.writeln("module.exports = Aria.classDefinition({");
out.increaseIndent();
out.writeln("$classpath: ", out.stringify(tplParam.$classpath), ",");
if (out.parentClasspath) {
out.writeln("$extends: require(", out.stringify(Aria.getLogicalPath(out.parentClasspath, Aria.ACCEPTED_TYPES[out.parentClassType])), "),");
}
} | [
"function",
"(",
"out",
")",
"{",
"var",
"tplParam",
"=",
"out",
".",
"templateParam",
";",
"out",
".",
"writeln",
"(",
"\"module.exports = Aria.classDefinition({\"",
")",
";",
"out",
".",
"increaseIndent",
"(",
")",
";",
"out",
".",
"writeln",
"(",
"\"$classpath: \"",
",",
"out",
".",
"stringify",
"(",
"tplParam",
".",
"$classpath",
")",
",",
"\",\"",
")",
";",
"if",
"(",
"out",
".",
"parentClasspath",
")",
"{",
"out",
".",
"writeln",
"(",
"\"$extends: require(\"",
",",
"out",
".",
"stringify",
"(",
"Aria",
".",
"getLogicalPath",
"(",
"out",
".",
"parentClasspath",
",",
"Aria",
".",
"ACCEPTED_TYPES",
"[",
"out",
".",
"parentClassType",
"]",
")",
")",
",",
"\"),\"",
")",
";",
"}",
"}"
]
| Write to the current block of the class writer the begining of the class definition.
@param {aria.templates.ClassWriter} out
@protected | [
"Write",
"to",
"the",
"current",
"block",
"of",
"the",
"class",
"writer",
"the",
"begining",
"of",
"the",
"class",
"definition",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L336-L344 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out) {
var tplParam = out.templateParam;
// normal inheritance processing: set out.parentClasspath, out.parentClassName and out.parentClassType
if (tplParam.$extends) {
out.parentClasspath = tplParam.$extends;
out.parentClassType = this._classType;
} else {
out.parentClasspath = this._superClass;
}
if (out.parentClasspath) {
out.parentClassName = this._getClassName(out.parentClasspath);
}
} | javascript | function (out) {
var tplParam = out.templateParam;
// normal inheritance processing: set out.parentClasspath, out.parentClassName and out.parentClassType
if (tplParam.$extends) {
out.parentClasspath = tplParam.$extends;
out.parentClassType = this._classType;
} else {
out.parentClasspath = this._superClass;
}
if (out.parentClasspath) {
out.parentClassName = this._getClassName(out.parentClasspath);
}
} | [
"function",
"(",
"out",
")",
"{",
"var",
"tplParam",
"=",
"out",
".",
"templateParam",
";",
"if",
"(",
"tplParam",
".",
"$extends",
")",
"{",
"out",
".",
"parentClasspath",
"=",
"tplParam",
".",
"$extends",
";",
"out",
".",
"parentClassType",
"=",
"this",
".",
"_classType",
";",
"}",
"else",
"{",
"out",
".",
"parentClasspath",
"=",
"this",
".",
"_superClass",
";",
"}",
"if",
"(",
"out",
".",
"parentClasspath",
")",
"{",
"out",
".",
"parentClassName",
"=",
"this",
".",
"_getClassName",
"(",
"out",
".",
"parentClasspath",
")",
";",
"}",
"}"
]
| Set the out.parentClasspath, out.parentClassName and out.parentClassType from the values available in
out.templateParam.
@param {aria.templates.ClassWriter} out
@protected | [
"Set",
"the",
"out",
".",
"parentClasspath",
"out",
".",
"parentClassName",
"and",
"out",
".",
"parentClassType",
"from",
"the",
"values",
"available",
"in",
"out",
".",
"templateParam",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L363-L375 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out) {
var tplParam = out.templateParam;
if (tplParam.$hasScript) {
out.scriptClasspath = tplParam.$classpath + "Script";
out.scriptClassName = this._getClassName(out.scriptClasspath);
out.addDependency(out.scriptClasspath);
}
} | javascript | function (out) {
var tplParam = out.templateParam;
if (tplParam.$hasScript) {
out.scriptClasspath = tplParam.$classpath + "Script";
out.scriptClassName = this._getClassName(out.scriptClasspath);
out.addDependency(out.scriptClasspath);
}
} | [
"function",
"(",
"out",
")",
"{",
"var",
"tplParam",
"=",
"out",
".",
"templateParam",
";",
"if",
"(",
"tplParam",
".",
"$hasScript",
")",
"{",
"out",
".",
"scriptClasspath",
"=",
"tplParam",
".",
"$classpath",
"+",
"\"Script\"",
";",
"out",
".",
"scriptClassName",
"=",
"this",
".",
"_getClassName",
"(",
"out",
".",
"scriptClasspath",
")",
";",
"out",
".",
"addDependency",
"(",
"out",
".",
"scriptClasspath",
")",
";",
"}",
"}"
]
| Set the out.scriptClasspath, out.scriptClassName from the values available in out.templateParam.
@param {aria.templates.ClassWriter} out
@protected | [
"Set",
"the",
"out",
".",
"scriptClasspath",
"out",
".",
"scriptClassName",
"from",
"the",
"values",
"available",
"in",
"out",
".",
"templateParam",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L382-L389 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out) {
out.writeln("$constructor: function() { ");
out.increaseIndent();
var parentClassName = out.parentClassName;
if (parentClassName) {
out.writeln("this.$", parentClassName, ".constructor.call(this);");
}
var scriptClassName = out.scriptClassName;
if (scriptClassName) {
out.writeln("this.$", scriptClassName, ".constructor.call(this);");
}
out.decreaseIndent();
out.writeln("},");
} | javascript | function (out) {
out.writeln("$constructor: function() { ");
out.increaseIndent();
var parentClassName = out.parentClassName;
if (parentClassName) {
out.writeln("this.$", parentClassName, ".constructor.call(this);");
}
var scriptClassName = out.scriptClassName;
if (scriptClassName) {
out.writeln("this.$", scriptClassName, ".constructor.call(this);");
}
out.decreaseIndent();
out.writeln("},");
} | [
"function",
"(",
"out",
")",
"{",
"out",
".",
"writeln",
"(",
"\"$constructor: function() { \"",
")",
";",
"out",
".",
"increaseIndent",
"(",
")",
";",
"var",
"parentClassName",
"=",
"out",
".",
"parentClassName",
";",
"if",
"(",
"parentClassName",
")",
"{",
"out",
".",
"writeln",
"(",
"\"this.$\"",
",",
"parentClassName",
",",
"\".constructor.call(this);\"",
")",
";",
"}",
"var",
"scriptClassName",
"=",
"out",
".",
"scriptClassName",
";",
"if",
"(",
"scriptClassName",
")",
"{",
"out",
".",
"writeln",
"(",
"\"this.$\"",
",",
"scriptClassName",
",",
"\".constructor.call(this);\"",
")",
";",
"}",
"out",
".",
"decreaseIndent",
"(",
")",
";",
"out",
".",
"writeln",
"(",
"\"},\"",
")",
";",
"}"
]
| Write to the current block of the class writer the constructor of the class definition. The body of the
method contains a call to the parent constructor and a call to the script constructor.
@param {aria.templates.ClassWriter} out
@protected | [
"Write",
"to",
"the",
"current",
"block",
"of",
"the",
"class",
"writer",
"the",
"constructor",
"of",
"the",
"class",
"definition",
".",
"The",
"body",
"of",
"the",
"method",
"contains",
"a",
"call",
"to",
"the",
"parent",
"constructor",
"and",
"a",
"call",
"to",
"the",
"script",
"constructor",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L397-L410 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out, res) {
if (typeof res == "string") {
var logicalPath = Aria.getLogicalPath(res);
var serverRes = /([^\/]*)\/Res$/.exec(logicalPath);
return 'require("ariatemplates/$resources").' + (serverRes ? "module(" + out.stringify(serverRes[1]) + "," : "file(")
+ out.stringify(logicalPath) + ")";
}
if (typeof res == "object") {
var tplParam = out.templateParam;
var params = ["", Aria.getLogicalPath(res.provider), tplParam.$classpath, res.onLoad || "",
res.handler || ""].concat(res.resources || []);
for (var i = 0, l = params.length; i < l; i++) {
params[i] = out.stringify(params[i]);
}
return 'require("ariatemplates/$resourcesProviders").fetch(' + params.join(",") + ')';
}
} | javascript | function (out, res) {
if (typeof res == "string") {
var logicalPath = Aria.getLogicalPath(res);
var serverRes = /([^\/]*)\/Res$/.exec(logicalPath);
return 'require("ariatemplates/$resources").' + (serverRes ? "module(" + out.stringify(serverRes[1]) + "," : "file(")
+ out.stringify(logicalPath) + ")";
}
if (typeof res == "object") {
var tplParam = out.templateParam;
var params = ["", Aria.getLogicalPath(res.provider), tplParam.$classpath, res.onLoad || "",
res.handler || ""].concat(res.resources || []);
for (var i = 0, l = params.length; i < l; i++) {
params[i] = out.stringify(params[i]);
}
return 'require("ariatemplates/$resourcesProviders").fetch(' + params.join(",") + ')';
}
} | [
"function",
"(",
"out",
",",
"res",
")",
"{",
"if",
"(",
"typeof",
"res",
"==",
"\"string\"",
")",
"{",
"var",
"logicalPath",
"=",
"Aria",
".",
"getLogicalPath",
"(",
"res",
")",
";",
"var",
"serverRes",
"=",
"/",
"([^\\/]*)\\/Res$",
"/",
".",
"exec",
"(",
"logicalPath",
")",
";",
"return",
"'require(\"ariatemplates/$resources\").'",
"+",
"(",
"serverRes",
"?",
"\"module(\"",
"+",
"out",
".",
"stringify",
"(",
"serverRes",
"[",
"1",
"]",
")",
"+",
"\",\"",
":",
"\"file(\"",
")",
"+",
"out",
".",
"stringify",
"(",
"logicalPath",
")",
"+",
"\")\"",
";",
"}",
"if",
"(",
"typeof",
"res",
"==",
"\"object\"",
")",
"{",
"var",
"tplParam",
"=",
"out",
".",
"templateParam",
";",
"var",
"params",
"=",
"[",
"\"\"",
",",
"Aria",
".",
"getLogicalPath",
"(",
"res",
".",
"provider",
")",
",",
"tplParam",
".",
"$classpath",
",",
"res",
".",
"onLoad",
"||",
"\"\"",
",",
"res",
".",
"handler",
"||",
"\"\"",
"]",
".",
"concat",
"(",
"res",
".",
"resources",
"||",
"[",
"]",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"params",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"params",
"[",
"i",
"]",
"=",
"out",
".",
"stringify",
"(",
"params",
"[",
"i",
"]",
")",
";",
"}",
"return",
"'require(\"ariatemplates/$resourcesProviders\").fetch('",
"+",
"params",
".",
"join",
"(",
"\",\"",
")",
"+",
"')'",
";",
"}",
"}"
]
| Returns a resource dependency
@param {Object|String} res | [
"Returns",
"a",
"resource",
"dependency"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L454-L470 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out) {
var tplParam = out.templateParam;
var res = tplParam.$res;
if (res) {
out.writeln("$resources: {");
out.increaseIndent();
var first = true;
for (var key in res) {
if (res.hasOwnProperty(key)) {
out.writeln(first ? "" : ",", out.stringify(key), ": ", this._getResourceDependency(out, res[key]));
first = false;
}
}
out.decreaseIndent();
out.writeln("},");
}
var css = tplParam.$css;
if (css && css.length) {
out.writeln("$css: [");
out.increaseIndent();
for (var i = 0, l = css.length; i < l; i++) {
out.writeln("require(", out.stringify(Aria.getLogicalPath(css[i], ".tpl.css")), (i == l - 1
? ")"
: "),"));
}
out.decreaseIndent();
out.writeln("],");
}
var texts = tplParam.$texts;
if (texts) {
out.writeln("$texts: {");
out.increaseIndent();
var first = true;
for (var key in texts) {
if (texts.hasOwnProperty(key)) {
out.writeln(first ? "" : ",", out.stringify(key), ": require(", out.stringify(Aria.getLogicalPath(texts[key], ".tpl.txt"))
+ ")");
first = false;
}
}
out.decreaseIndent();
out.writeln("},");
}
} | javascript | function (out) {
var tplParam = out.templateParam;
var res = tplParam.$res;
if (res) {
out.writeln("$resources: {");
out.increaseIndent();
var first = true;
for (var key in res) {
if (res.hasOwnProperty(key)) {
out.writeln(first ? "" : ",", out.stringify(key), ": ", this._getResourceDependency(out, res[key]));
first = false;
}
}
out.decreaseIndent();
out.writeln("},");
}
var css = tplParam.$css;
if (css && css.length) {
out.writeln("$css: [");
out.increaseIndent();
for (var i = 0, l = css.length; i < l; i++) {
out.writeln("require(", out.stringify(Aria.getLogicalPath(css[i], ".tpl.css")), (i == l - 1
? ")"
: "),"));
}
out.decreaseIndent();
out.writeln("],");
}
var texts = tplParam.$texts;
if (texts) {
out.writeln("$texts: {");
out.increaseIndent();
var first = true;
for (var key in texts) {
if (texts.hasOwnProperty(key)) {
out.writeln(first ? "" : ",", out.stringify(key), ": require(", out.stringify(Aria.getLogicalPath(texts[key], ".tpl.txt"))
+ ")");
first = false;
}
}
out.decreaseIndent();
out.writeln("},");
}
} | [
"function",
"(",
"out",
")",
"{",
"var",
"tplParam",
"=",
"out",
".",
"templateParam",
";",
"var",
"res",
"=",
"tplParam",
".",
"$res",
";",
"if",
"(",
"res",
")",
"{",
"out",
".",
"writeln",
"(",
"\"$resources: {\"",
")",
";",
"out",
".",
"increaseIndent",
"(",
")",
";",
"var",
"first",
"=",
"true",
";",
"for",
"(",
"var",
"key",
"in",
"res",
")",
"{",
"if",
"(",
"res",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"out",
".",
"writeln",
"(",
"first",
"?",
"\"\"",
":",
"\",\"",
",",
"out",
".",
"stringify",
"(",
"key",
")",
",",
"\": \"",
",",
"this",
".",
"_getResourceDependency",
"(",
"out",
",",
"res",
"[",
"key",
"]",
")",
")",
";",
"first",
"=",
"false",
";",
"}",
"}",
"out",
".",
"decreaseIndent",
"(",
")",
";",
"out",
".",
"writeln",
"(",
"\"},\"",
")",
";",
"}",
"var",
"css",
"=",
"tplParam",
".",
"$css",
";",
"if",
"(",
"css",
"&&",
"css",
".",
"length",
")",
"{",
"out",
".",
"writeln",
"(",
"\"$css: [\"",
")",
";",
"out",
".",
"increaseIndent",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"css",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"out",
".",
"writeln",
"(",
"\"require(\"",
",",
"out",
".",
"stringify",
"(",
"Aria",
".",
"getLogicalPath",
"(",
"css",
"[",
"i",
"]",
",",
"\".tpl.css\"",
")",
")",
",",
"(",
"i",
"==",
"l",
"-",
"1",
"?",
"\")\"",
":",
"\"),\"",
")",
")",
";",
"}",
"out",
".",
"decreaseIndent",
"(",
")",
";",
"out",
".",
"writeln",
"(",
"\"],\"",
")",
";",
"}",
"var",
"texts",
"=",
"tplParam",
".",
"$texts",
";",
"if",
"(",
"texts",
")",
"{",
"out",
".",
"writeln",
"(",
"\"$texts: {\"",
")",
";",
"out",
".",
"increaseIndent",
"(",
")",
";",
"var",
"first",
"=",
"true",
";",
"for",
"(",
"var",
"key",
"in",
"texts",
")",
"{",
"if",
"(",
"texts",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"out",
".",
"writeln",
"(",
"first",
"?",
"\"\"",
":",
"\",\"",
",",
"out",
".",
"stringify",
"(",
"key",
")",
",",
"\": require(\"",
",",
"out",
".",
"stringify",
"(",
"Aria",
".",
"getLogicalPath",
"(",
"texts",
"[",
"key",
"]",
",",
"\".tpl.txt\"",
")",
")",
"+",
"\")\"",
")",
";",
"first",
"=",
"false",
";",
"}",
"}",
"out",
".",
"decreaseIndent",
"(",
")",
";",
"out",
".",
"writeln",
"(",
"\"},\"",
")",
";",
"}",
"}"
]
| Write to the current block of the class writer the dependencies of the template, including JS classes,
resources, templates, css, macrolibs and text templates.
@param {aria.templates.ClassWriter} out
@protected | [
"Write",
"to",
"the",
"current",
"block",
"of",
"the",
"class",
"writer",
"the",
"dependencies",
"of",
"the",
"template",
"including",
"JS",
"classes",
"resources",
"templates",
"css",
"macrolibs",
"and",
"text",
"templates",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L478-L521 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (out) {
out.writeln("$prototype: {");
out.increaseIndent();
out.write(out.getBlockContent("prototype"));
out.decreaseIndent();
out.writeln("}");
out.decreaseIndent();
out.writeln("});");
out.leaveBlock();
} | javascript | function (out) {
out.writeln("$prototype: {");
out.increaseIndent();
out.write(out.getBlockContent("prototype"));
out.decreaseIndent();
out.writeln("}");
out.decreaseIndent();
out.writeln("});");
out.leaveBlock();
} | [
"function",
"(",
"out",
")",
"{",
"out",
".",
"writeln",
"(",
"\"$prototype: {\"",
")",
";",
"out",
".",
"increaseIndent",
"(",
")",
";",
"out",
".",
"write",
"(",
"out",
".",
"getBlockContent",
"(",
"\"prototype\"",
")",
")",
";",
"out",
".",
"decreaseIndent",
"(",
")",
";",
"out",
".",
"writeln",
"(",
"\"}\"",
")",
";",
"out",
".",
"decreaseIndent",
"(",
")",
";",
"out",
".",
"writeln",
"(",
"\"});\"",
")",
";",
"out",
".",
"leaveBlock",
"(",
")",
";",
"}"
]
| Write to the current block of the class writer the end of the class definition, including the prototype block
of the class writer.
@param {aria.templates.ClassWriter} out
@protected | [
"Write",
"to",
"the",
"current",
"block",
"of",
"the",
"class",
"writer",
"the",
"end",
"of",
"the",
"class",
"definition",
"including",
"the",
"prototype",
"block",
"of",
"the",
"class",
"writer",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L642-L651 | train |
|
ariatemplates/ariatemplates | src/aria/templates/ClassGenerator.js | function (arg) {
var out = arg.out;
var statement = arg.statement;
// Add dependencies specified explicitly in the template declaration
this._processDependencies(out);
this._createBlocks(out);
this._processInheritance(out);
this._processScript(out);
out.enterBlock("main");
out.writeln("var Aria = require('ariatemplates/Aria');");
out.leaveBlock();
out.enterBlock("classDefinition");
this._writeClassDefHeaders(out);
this._writeConstructor(out);
this._writeDestructor(out);
out.leaveBlock();
// main part of the processing (process the whole template):
out.processContent(statement.content);
if (out.errors) {
out.$dispose();
this.$callback(out.callback, {
classDef : null,
errors : out.errors
});
// in case of synchronous call, the following line prevents a second call of the callback
// to report the error
out.errors = false;
return;
}
out.enterBlock("prototype");
this._writeClassInit(out);
this._writeInitTemplate(out);
out.leaveBlock();
out.enterBlock("classDefinition");
this._writeDependencies(out);
this._writeClassDefEnd(out);
out.leaveBlock();
out.enterBlock("main");
out.writeDependencies();
out.write(out.getBlockContent("classDefinition"));
out.leaveBlock();
out.tree.properties = {
macros: out.macros,
views: out.views,
wlibs: out.wlibs
};
var res = null;
res = out.getBlockContent("main");
out.$dispose();
this.$callback(out.callback, {
classDef : res,
logicalPath : Aria.getLogicalPath(out.templateParam.$classpath, Aria.ACCEPTED_TYPES[this._classType]),
tree : out.tree,
debug : out.debug
});
} | javascript | function (arg) {
var out = arg.out;
var statement = arg.statement;
// Add dependencies specified explicitly in the template declaration
this._processDependencies(out);
this._createBlocks(out);
this._processInheritance(out);
this._processScript(out);
out.enterBlock("main");
out.writeln("var Aria = require('ariatemplates/Aria');");
out.leaveBlock();
out.enterBlock("classDefinition");
this._writeClassDefHeaders(out);
this._writeConstructor(out);
this._writeDestructor(out);
out.leaveBlock();
// main part of the processing (process the whole template):
out.processContent(statement.content);
if (out.errors) {
out.$dispose();
this.$callback(out.callback, {
classDef : null,
errors : out.errors
});
// in case of synchronous call, the following line prevents a second call of the callback
// to report the error
out.errors = false;
return;
}
out.enterBlock("prototype");
this._writeClassInit(out);
this._writeInitTemplate(out);
out.leaveBlock();
out.enterBlock("classDefinition");
this._writeDependencies(out);
this._writeClassDefEnd(out);
out.leaveBlock();
out.enterBlock("main");
out.writeDependencies();
out.write(out.getBlockContent("classDefinition"));
out.leaveBlock();
out.tree.properties = {
macros: out.macros,
views: out.views,
wlibs: out.wlibs
};
var res = null;
res = out.getBlockContent("main");
out.$dispose();
this.$callback(out.callback, {
classDef : res,
logicalPath : Aria.getLogicalPath(out.templateParam.$classpath, Aria.ACCEPTED_TYPES[this._classType]),
tree : out.tree,
debug : out.debug
});
} | [
"function",
"(",
"arg",
")",
"{",
"var",
"out",
"=",
"arg",
".",
"out",
";",
"var",
"statement",
"=",
"arg",
".",
"statement",
";",
"this",
".",
"_processDependencies",
"(",
"out",
")",
";",
"this",
".",
"_createBlocks",
"(",
"out",
")",
";",
"this",
".",
"_processInheritance",
"(",
"out",
")",
";",
"this",
".",
"_processScript",
"(",
"out",
")",
";",
"out",
".",
"enterBlock",
"(",
"\"main\"",
")",
";",
"out",
".",
"writeln",
"(",
"\"var Aria = require('ariatemplates/Aria');\"",
")",
";",
"out",
".",
"leaveBlock",
"(",
")",
";",
"out",
".",
"enterBlock",
"(",
"\"classDefinition\"",
")",
";",
"this",
".",
"_writeClassDefHeaders",
"(",
"out",
")",
";",
"this",
".",
"_writeConstructor",
"(",
"out",
")",
";",
"this",
".",
"_writeDestructor",
"(",
"out",
")",
";",
"out",
".",
"leaveBlock",
"(",
")",
";",
"out",
".",
"processContent",
"(",
"statement",
".",
"content",
")",
";",
"if",
"(",
"out",
".",
"errors",
")",
"{",
"out",
".",
"$dispose",
"(",
")",
";",
"this",
".",
"$callback",
"(",
"out",
".",
"callback",
",",
"{",
"classDef",
":",
"null",
",",
"errors",
":",
"out",
".",
"errors",
"}",
")",
";",
"out",
".",
"errors",
"=",
"false",
";",
"return",
";",
"}",
"out",
".",
"enterBlock",
"(",
"\"prototype\"",
")",
";",
"this",
".",
"_writeClassInit",
"(",
"out",
")",
";",
"this",
".",
"_writeInitTemplate",
"(",
"out",
")",
";",
"out",
".",
"leaveBlock",
"(",
")",
";",
"out",
".",
"enterBlock",
"(",
"\"classDefinition\"",
")",
";",
"this",
".",
"_writeDependencies",
"(",
"out",
")",
";",
"this",
".",
"_writeClassDefEnd",
"(",
"out",
")",
";",
"out",
".",
"leaveBlock",
"(",
")",
";",
"out",
".",
"enterBlock",
"(",
"\"main\"",
")",
";",
"out",
".",
"writeDependencies",
"(",
")",
";",
"out",
".",
"write",
"(",
"out",
".",
"getBlockContent",
"(",
"\"classDefinition\"",
")",
")",
";",
"out",
".",
"leaveBlock",
"(",
")",
";",
"out",
".",
"tree",
".",
"properties",
"=",
"{",
"macros",
":",
"out",
".",
"macros",
",",
"views",
":",
"out",
".",
"views",
",",
"wlibs",
":",
"out",
".",
"wlibs",
"}",
";",
"var",
"res",
"=",
"null",
";",
"res",
"=",
"out",
".",
"getBlockContent",
"(",
"\"main\"",
")",
";",
"out",
".",
"$dispose",
"(",
")",
";",
"this",
".",
"$callback",
"(",
"out",
".",
"callback",
",",
"{",
"classDef",
":",
"res",
",",
"logicalPath",
":",
"Aria",
".",
"getLogicalPath",
"(",
"out",
".",
"templateParam",
".",
"$classpath",
",",
"Aria",
".",
"ACCEPTED_TYPES",
"[",
"this",
".",
"_classType",
"]",
")",
",",
"tree",
":",
"out",
".",
"tree",
",",
"debug",
":",
"out",
".",
"debug",
"}",
")",
";",
"}"
]
| Process template content. This method is called from _processRootStatement.
@param {Object} Process template content properties (contains out and statement objects).
@protected | [
"Process",
"template",
"content",
".",
"This",
"method",
"is",
"called",
"from",
"_processRootStatement",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ClassGenerator.js#L658-L723 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (elt1, elt2) {
if (elt1.sortKey == elt2.sortKey) {
return 0;
}
return (elt1.sortKey > elt2.sortKey ? 1 : -1);
} | javascript | function (elt1, elt2) {
if (elt1.sortKey == elt2.sortKey) {
return 0;
}
return (elt1.sortKey > elt2.sortKey ? 1 : -1);
} | [
"function",
"(",
"elt1",
",",
"elt2",
")",
"{",
"if",
"(",
"elt1",
".",
"sortKey",
"==",
"elt2",
".",
"sortKey",
")",
"{",
"return",
"0",
";",
"}",
"return",
"(",
"elt1",
".",
"sortKey",
">",
"elt2",
".",
"sortKey",
"?",
"1",
":",
"-",
"1",
")",
";",
"}"
]
| Sorting function by ascending sortKey. Function given as a parameter to the Array.sort JavaScript function for
sorting. It compares two elements and return a value telling which one should be put before the other.
@param {aria.templates.ViewCfgBeans:Item} elt1
@param {aria.templates.ViewCfgBeans:Item} elt2
@return {Integer} -1 if elt1.sortKey < elt2.sortKey, 0 if elt1.sortKey == elt2.sortKey, 1 if elt1.sortKey >
elt2.sortKey
@private | [
"Sorting",
"function",
"by",
"ascending",
"sortKey",
".",
"Function",
"given",
"as",
"a",
"parameter",
"to",
"the",
"Array",
".",
"sort",
"JavaScript",
"function",
"for",
"sorting",
".",
"It",
"compares",
"two",
"elements",
"and",
"return",
"a",
"value",
"telling",
"which",
"one",
"should",
"be",
"put",
"before",
"the",
"other",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L32-L37 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (obj) {
if (!(ariaUtilsType.isObject(obj) || ariaUtilsType.isArray(obj))) {
this.$logError(this.INVALID_TYPE_OF_ARGUMENT);
return;
}
/**
* Contains the initial array or map from which the view is built. This can be changed outside this class at
* any time. If you add, remove, or replace elements in this array or map, you should call the notifyChange
* method with CHANGED_INITIAL_ARRAY, so that the view knows it should update its data in the next refresh.
* If changing the reference with viewobj.initialArray = ..., the call of notifyChange is not necessary (it
* is automatically detected). If the property of an element inside the array or map is changed you do not
* need to call notifyChange, unless this property has an incidence on the sort order, in which case you
* should use CHANGED_SORT_CRITERIA. The initial array or map is never changed by the view itself.
* @type Array|Object
*/
this.initialArray = obj;
/**
* Sort order, which can be SORT_INITIAL, SORT_ASCENDING, or SORT_DESCENDING. If you modify this property,
* it is not taken into account until the next refresh.
* @type String
*/
this.sortOrder = this.SORT_INITIAL;
/**
* An id to use to define the type of sort (e.g. "sortByName"). Allows to detect different consecutive sort
* types. Ignored (and will be set to null) if this.sortOrder == this.SORT_INITIAL. If you modify this
* property, it is not taken into account until the next refresh.
* @type String
*/
this.sortName = null;
/**
* Function which returns the sort key, for each element. The first parameter of the callback is of type
* aria.templates.ViewCfgBeans.Item. Ignored (and will be set to null) if this.sortOrder ==
* this.SORT_INITIAL. If you modify this property, it is not taken into account until the next refresh.
* @type aria.core.CfgBeans:Callback
*/
this.sortKeyGetter = null;
/**
* Array of items (of type aria.templates.ViewCfgBeans.Item) in the correct sort order. This array must not
* be modified outside this class, except for the filteredIn property of each element, which can be set
* (through aria.utils.Json.setValue) to filter in or filter out an element directly.
* @type Array
*/
this.items = [];
/**
* Number of filtered in elements. This property is updated in a refresh if needed.
* @type Integer
*/
this.filteredInCount = 0;
/**
* Number of elements per page. > 0 if in pageMode, -1 otherwise. If you modify this property, it is not
* taken into account until the next refresh.
* @type Integer
*/
this.pageSize = -1;
/**
* True if page-view is activated, false otherwise. This property must not be modified outside this class.
* It is updated in a refresh.
* @type Boolean
*/
this.pageMode = false;
/**
* Contains the index of the current page, 0 for the first page. If page mode is disabled, must be 0. If you
* modify this property, it is not taken into account until the next refresh. You can use
* setCurrentPageIndex method to both change current page and do the refresh.
*/
this.currentPageIndex = 0;
/**
* Array of pages. This property must not be modified outside this class. It is updated in a refresh if
* needed.
*/
this.pages = this.EMPTY_PAGES;
/**
* Keep the last values of modifiable properties to detect changes since the last refresh.
* @protected
*/
this._currentState = {
initialArray : null,
sortOrder : this.sortOrder,
sortName : this.sortName,
sortKeyGetter : this.sortKeyGetter,
pageSize : this.pageSize,
currentPageIndex : this.currentPageIndex
};
/**
* Bitwise OR of all notified changes since the last refresh.
* @protected
*/
this._changes = 0;
/**
* Callback structure used when listening to json objects.
* @type aria.core.CfgBeans:Callback
* @protected
*/
this._jsonChangeCallback = {
fn : this._notifyDataChange,
scope : this
};
this._refreshInitialArray();
} | javascript | function (obj) {
if (!(ariaUtilsType.isObject(obj) || ariaUtilsType.isArray(obj))) {
this.$logError(this.INVALID_TYPE_OF_ARGUMENT);
return;
}
/**
* Contains the initial array or map from which the view is built. This can be changed outside this class at
* any time. If you add, remove, or replace elements in this array or map, you should call the notifyChange
* method with CHANGED_INITIAL_ARRAY, so that the view knows it should update its data in the next refresh.
* If changing the reference with viewobj.initialArray = ..., the call of notifyChange is not necessary (it
* is automatically detected). If the property of an element inside the array or map is changed you do not
* need to call notifyChange, unless this property has an incidence on the sort order, in which case you
* should use CHANGED_SORT_CRITERIA. The initial array or map is never changed by the view itself.
* @type Array|Object
*/
this.initialArray = obj;
/**
* Sort order, which can be SORT_INITIAL, SORT_ASCENDING, or SORT_DESCENDING. If you modify this property,
* it is not taken into account until the next refresh.
* @type String
*/
this.sortOrder = this.SORT_INITIAL;
/**
* An id to use to define the type of sort (e.g. "sortByName"). Allows to detect different consecutive sort
* types. Ignored (and will be set to null) if this.sortOrder == this.SORT_INITIAL. If you modify this
* property, it is not taken into account until the next refresh.
* @type String
*/
this.sortName = null;
/**
* Function which returns the sort key, for each element. The first parameter of the callback is of type
* aria.templates.ViewCfgBeans.Item. Ignored (and will be set to null) if this.sortOrder ==
* this.SORT_INITIAL. If you modify this property, it is not taken into account until the next refresh.
* @type aria.core.CfgBeans:Callback
*/
this.sortKeyGetter = null;
/**
* Array of items (of type aria.templates.ViewCfgBeans.Item) in the correct sort order. This array must not
* be modified outside this class, except for the filteredIn property of each element, which can be set
* (through aria.utils.Json.setValue) to filter in or filter out an element directly.
* @type Array
*/
this.items = [];
/**
* Number of filtered in elements. This property is updated in a refresh if needed.
* @type Integer
*/
this.filteredInCount = 0;
/**
* Number of elements per page. > 0 if in pageMode, -1 otherwise. If you modify this property, it is not
* taken into account until the next refresh.
* @type Integer
*/
this.pageSize = -1;
/**
* True if page-view is activated, false otherwise. This property must not be modified outside this class.
* It is updated in a refresh.
* @type Boolean
*/
this.pageMode = false;
/**
* Contains the index of the current page, 0 for the first page. If page mode is disabled, must be 0. If you
* modify this property, it is not taken into account until the next refresh. You can use
* setCurrentPageIndex method to both change current page and do the refresh.
*/
this.currentPageIndex = 0;
/**
* Array of pages. This property must not be modified outside this class. It is updated in a refresh if
* needed.
*/
this.pages = this.EMPTY_PAGES;
/**
* Keep the last values of modifiable properties to detect changes since the last refresh.
* @protected
*/
this._currentState = {
initialArray : null,
sortOrder : this.sortOrder,
sortName : this.sortName,
sortKeyGetter : this.sortKeyGetter,
pageSize : this.pageSize,
currentPageIndex : this.currentPageIndex
};
/**
* Bitwise OR of all notified changes since the last refresh.
* @protected
*/
this._changes = 0;
/**
* Callback structure used when listening to json objects.
* @type aria.core.CfgBeans:Callback
* @protected
*/
this._jsonChangeCallback = {
fn : this._notifyDataChange,
scope : this
};
this._refreshInitialArray();
} | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"(",
"ariaUtilsType",
".",
"isObject",
"(",
"obj",
")",
"||",
"ariaUtilsType",
".",
"isArray",
"(",
"obj",
")",
")",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_TYPE_OF_ARGUMENT",
")",
";",
"return",
";",
"}",
"this",
".",
"initialArray",
"=",
"obj",
";",
"this",
".",
"sortOrder",
"=",
"this",
".",
"SORT_INITIAL",
";",
"this",
".",
"sortName",
"=",
"null",
";",
"this",
".",
"sortKeyGetter",
"=",
"null",
";",
"this",
".",
"items",
"=",
"[",
"]",
";",
"this",
".",
"filteredInCount",
"=",
"0",
";",
"this",
".",
"pageSize",
"=",
"-",
"1",
";",
"this",
".",
"pageMode",
"=",
"false",
";",
"this",
".",
"currentPageIndex",
"=",
"0",
";",
"this",
".",
"pages",
"=",
"this",
".",
"EMPTY_PAGES",
";",
"this",
".",
"_currentState",
"=",
"{",
"initialArray",
":",
"null",
",",
"sortOrder",
":",
"this",
".",
"sortOrder",
",",
"sortName",
":",
"this",
".",
"sortName",
",",
"sortKeyGetter",
":",
"this",
".",
"sortKeyGetter",
",",
"pageSize",
":",
"this",
".",
"pageSize",
",",
"currentPageIndex",
":",
"this",
".",
"currentPageIndex",
"}",
";",
"this",
".",
"_changes",
"=",
"0",
";",
"this",
".",
"_jsonChangeCallback",
"=",
"{",
"fn",
":",
"this",
".",
"_notifyDataChange",
",",
"scope",
":",
"this",
"}",
";",
"this",
".",
"_refreshInitialArray",
"(",
")",
";",
"}"
]
| Create a new view on the given array.
@param {Array|Object} obj array or map on which to create the view | [
"Create",
"a",
"new",
"view",
"on",
"the",
"given",
"array",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L88-L198 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (changeType) {
if (changeType) {
this.notifyChange(changeType);
}
var curState = this._currentState;
// initial array synchronization
this._refreshInitialArray();
this.$assert(156, curState.initialArray == this.initialArray);
// sort refresh
if (this.sortOrder == this.SORT_INITIAL) {
if (curState.sortOrder != this.SORT_INITIAL) {
this._resetSortOrder();
}
this.sortName = null;
this.sortKeyGetter = null;
} else if (curState.sortKeyGetter != this.sortKeyGetter || curState.sortName != this.sortName
|| (this._changes & this.CHANGED_SORT_CRITERIA)) {
this._sort();
} else if (this.sortOrder != curState.sortOrder) {
this.$assert(167, (this.sortOrder != this.SORT_INITIAL)
&& (curState.sortKeyGetter == this.sortKeyGetter) && (curState.sortName == this.sortName)
&& !(this._changes & this.CHANGED_SORT_CRITERIA));
// here, we have the same sort name, same sort key getter
// we have no change in the sort criteria, but different orders (ascending and descending),
// only have to reverse the order (less expensive than sorting)
this.items.reverse();
curState.sortOrder = this.sortOrder;
this._changes = this._changes | this._CHANGED_PAGE_DATA;
}
this.$assert(176, this.sortOrder == curState.sortOrder);
this.$assert(177, this.sortKeyGetter == curState.sortKeyGetter);
this.$assert(178, this.sortName == curState.sortName);
// page refresh
if (curState.pageSize != this.pageSize
|| (this._changes & (this._CHANGED_PAGE_DATA | this._CHANGED_FILTERED_IN))) {
this._refreshPageData();
}
this.$assert(181, this.pageSize == curState.pageSize);
if (this.pageMode) {
this.$assert(194, this.pages.length >= 0);
if (this.currentPageIndex < 0) {
this.currentPageIndex = 0;
} else if (this.currentPageIndex >= this.pages.length) {
this.currentPageIndex = this.pages.length - 1;
}
} else {
this.currentPageIndex = 0;
}
curState.currentPageIndex = this.currentPageIndex;
this._changes = 0;
} | javascript | function (changeType) {
if (changeType) {
this.notifyChange(changeType);
}
var curState = this._currentState;
// initial array synchronization
this._refreshInitialArray();
this.$assert(156, curState.initialArray == this.initialArray);
// sort refresh
if (this.sortOrder == this.SORT_INITIAL) {
if (curState.sortOrder != this.SORT_INITIAL) {
this._resetSortOrder();
}
this.sortName = null;
this.sortKeyGetter = null;
} else if (curState.sortKeyGetter != this.sortKeyGetter || curState.sortName != this.sortName
|| (this._changes & this.CHANGED_SORT_CRITERIA)) {
this._sort();
} else if (this.sortOrder != curState.sortOrder) {
this.$assert(167, (this.sortOrder != this.SORT_INITIAL)
&& (curState.sortKeyGetter == this.sortKeyGetter) && (curState.sortName == this.sortName)
&& !(this._changes & this.CHANGED_SORT_CRITERIA));
// here, we have the same sort name, same sort key getter
// we have no change in the sort criteria, but different orders (ascending and descending),
// only have to reverse the order (less expensive than sorting)
this.items.reverse();
curState.sortOrder = this.sortOrder;
this._changes = this._changes | this._CHANGED_PAGE_DATA;
}
this.$assert(176, this.sortOrder == curState.sortOrder);
this.$assert(177, this.sortKeyGetter == curState.sortKeyGetter);
this.$assert(178, this.sortName == curState.sortName);
// page refresh
if (curState.pageSize != this.pageSize
|| (this._changes & (this._CHANGED_PAGE_DATA | this._CHANGED_FILTERED_IN))) {
this._refreshPageData();
}
this.$assert(181, this.pageSize == curState.pageSize);
if (this.pageMode) {
this.$assert(194, this.pages.length >= 0);
if (this.currentPageIndex < 0) {
this.currentPageIndex = 0;
} else if (this.currentPageIndex >= this.pages.length) {
this.currentPageIndex = this.pages.length - 1;
}
} else {
this.currentPageIndex = 0;
}
curState.currentPageIndex = this.currentPageIndex;
this._changes = 0;
} | [
"function",
"(",
"changeType",
")",
"{",
"if",
"(",
"changeType",
")",
"{",
"this",
".",
"notifyChange",
"(",
"changeType",
")",
";",
"}",
"var",
"curState",
"=",
"this",
".",
"_currentState",
";",
"this",
".",
"_refreshInitialArray",
"(",
")",
";",
"this",
".",
"$assert",
"(",
"156",
",",
"curState",
".",
"initialArray",
"==",
"this",
".",
"initialArray",
")",
";",
"if",
"(",
"this",
".",
"sortOrder",
"==",
"this",
".",
"SORT_INITIAL",
")",
"{",
"if",
"(",
"curState",
".",
"sortOrder",
"!=",
"this",
".",
"SORT_INITIAL",
")",
"{",
"this",
".",
"_resetSortOrder",
"(",
")",
";",
"}",
"this",
".",
"sortName",
"=",
"null",
";",
"this",
".",
"sortKeyGetter",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"curState",
".",
"sortKeyGetter",
"!=",
"this",
".",
"sortKeyGetter",
"||",
"curState",
".",
"sortName",
"!=",
"this",
".",
"sortName",
"||",
"(",
"this",
".",
"_changes",
"&",
"this",
".",
"CHANGED_SORT_CRITERIA",
")",
")",
"{",
"this",
".",
"_sort",
"(",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"sortOrder",
"!=",
"curState",
".",
"sortOrder",
")",
"{",
"this",
".",
"$assert",
"(",
"167",
",",
"(",
"this",
".",
"sortOrder",
"!=",
"this",
".",
"SORT_INITIAL",
")",
"&&",
"(",
"curState",
".",
"sortKeyGetter",
"==",
"this",
".",
"sortKeyGetter",
")",
"&&",
"(",
"curState",
".",
"sortName",
"==",
"this",
".",
"sortName",
")",
"&&",
"!",
"(",
"this",
".",
"_changes",
"&",
"this",
".",
"CHANGED_SORT_CRITERIA",
")",
")",
";",
"this",
".",
"items",
".",
"reverse",
"(",
")",
";",
"curState",
".",
"sortOrder",
"=",
"this",
".",
"sortOrder",
";",
"this",
".",
"_changes",
"=",
"this",
".",
"_changes",
"|",
"this",
".",
"_CHANGED_PAGE_DATA",
";",
"}",
"this",
".",
"$assert",
"(",
"176",
",",
"this",
".",
"sortOrder",
"==",
"curState",
".",
"sortOrder",
")",
";",
"this",
".",
"$assert",
"(",
"177",
",",
"this",
".",
"sortKeyGetter",
"==",
"curState",
".",
"sortKeyGetter",
")",
";",
"this",
".",
"$assert",
"(",
"178",
",",
"this",
".",
"sortName",
"==",
"curState",
".",
"sortName",
")",
";",
"if",
"(",
"curState",
".",
"pageSize",
"!=",
"this",
".",
"pageSize",
"||",
"(",
"this",
".",
"_changes",
"&",
"(",
"this",
".",
"_CHANGED_PAGE_DATA",
"|",
"this",
".",
"_CHANGED_FILTERED_IN",
")",
")",
")",
"{",
"this",
".",
"_refreshPageData",
"(",
")",
";",
"}",
"this",
".",
"$assert",
"(",
"181",
",",
"this",
".",
"pageSize",
"==",
"curState",
".",
"pageSize",
")",
";",
"if",
"(",
"this",
".",
"pageMode",
")",
"{",
"this",
".",
"$assert",
"(",
"194",
",",
"this",
".",
"pages",
".",
"length",
">=",
"0",
")",
";",
"if",
"(",
"this",
".",
"currentPageIndex",
"<",
"0",
")",
"{",
"this",
".",
"currentPageIndex",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"this",
".",
"currentPageIndex",
">=",
"this",
".",
"pages",
".",
"length",
")",
"{",
"this",
".",
"currentPageIndex",
"=",
"this",
".",
"pages",
".",
"length",
"-",
"1",
";",
"}",
"}",
"else",
"{",
"this",
".",
"currentPageIndex",
"=",
"0",
";",
"}",
"curState",
".",
"currentPageIndex",
"=",
"this",
".",
"currentPageIndex",
";",
"this",
".",
"_changes",
"=",
"0",
";",
"}"
]
| Refresh the view data after something has changed. Do nothing if nothing has changed.
@param {Integer} changeType If specified, call notifyChange with that parameter before doing the refresh. This
parameter can be either CHANGED_INITIAL_ARRAY or CHANGED_SORT_CRITERIA or a bitwise OR of both. | [
"Refresh",
"the",
"view",
"data",
"after",
"something",
"has",
"changed",
".",
"Do",
"nothing",
"if",
"nothing",
"has",
"changed",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L265-L317 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (items) {
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
json.removeListener(items[i], "filteredIn", this._jsonChangeCallback);
}
} | javascript | function (items) {
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
json.removeListener(items[i], "filteredIn", this._jsonChangeCallback);
}
} | [
"function",
"(",
"items",
")",
"{",
"var",
"itemsLength",
"=",
"items",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"itemsLength",
";",
"i",
"++",
")",
"{",
"json",
".",
"removeListener",
"(",
"items",
"[",
"i",
"]",
",",
"\"filteredIn\"",
",",
"this",
".",
"_jsonChangeCallback",
")",
";",
"}",
"}"
]
| Remove the 'this' listener on each item of the given array.
@param {Array} array
@protected | [
"Remove",
"the",
"this",
"listener",
"on",
"each",
"item",
"of",
"the",
"given",
"array",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L334-L339 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function () {
var curState = this._currentState;
var initialArray = this.initialArray;
var oldValues; // map of old values
if (curState.initialArray == initialArray && !(this._changes & this.CHANGED_INITIAL_ARRAY)) {
return;
}
if (curState.initialArray) {
// there was already an array, let's keep its values
// to keep filteredInState when old values are reused
oldValues = new ariaUtilsStackHashMap();
var oldItems = this.items;
var oldItemsLength = oldItems.length, oldElt;
for (var i = 0; i < oldItemsLength; i++) {
oldElt = oldItems[i];
oldValues.push(oldElt.value, oldElt);
}
}
if (ariaUtilsType.isObject(initialArray)) {
var returnedItems = this._getItemsFromMap(oldValues);
} else {
var returnedItems = this._getItemsFromArray(oldValues);
}
if (oldValues) {
this._removeListenersOnItems(oldValues.removeAll());
oldValues.$dispose();
}
this.items = returnedItems.items;
var filteredOutElements = returnedItems.filteredOutElements;
var arrayLength = this.items.length;
curState.initialArray = initialArray;
curState.sortOrder = this.SORT_INITIAL;
curState.sortName = null;
curState.sortKeyGetter = null;
curState.pageSize = -1;
this.filteredInCount = arrayLength - filteredOutElements;
this.pages = [{ // page mode disabled: only one page
pageIndex : 0,
pageNumber : 1,
firstItemIndex : 0,
lastItemIndex : arrayLength - 1,
firstItemNumber : arrayLength > 0 ? 1 : 0,
lastItemNumber : this.filteredInCount
}];
this._changes = this._changes & !this.CHANGED_INITIAL_ARRAY; // don't add _CHANGED_PAGE_DATA because
// we did the job here
} | javascript | function () {
var curState = this._currentState;
var initialArray = this.initialArray;
var oldValues; // map of old values
if (curState.initialArray == initialArray && !(this._changes & this.CHANGED_INITIAL_ARRAY)) {
return;
}
if (curState.initialArray) {
// there was already an array, let's keep its values
// to keep filteredInState when old values are reused
oldValues = new ariaUtilsStackHashMap();
var oldItems = this.items;
var oldItemsLength = oldItems.length, oldElt;
for (var i = 0; i < oldItemsLength; i++) {
oldElt = oldItems[i];
oldValues.push(oldElt.value, oldElt);
}
}
if (ariaUtilsType.isObject(initialArray)) {
var returnedItems = this._getItemsFromMap(oldValues);
} else {
var returnedItems = this._getItemsFromArray(oldValues);
}
if (oldValues) {
this._removeListenersOnItems(oldValues.removeAll());
oldValues.$dispose();
}
this.items = returnedItems.items;
var filteredOutElements = returnedItems.filteredOutElements;
var arrayLength = this.items.length;
curState.initialArray = initialArray;
curState.sortOrder = this.SORT_INITIAL;
curState.sortName = null;
curState.sortKeyGetter = null;
curState.pageSize = -1;
this.filteredInCount = arrayLength - filteredOutElements;
this.pages = [{ // page mode disabled: only one page
pageIndex : 0,
pageNumber : 1,
firstItemIndex : 0,
lastItemIndex : arrayLength - 1,
firstItemNumber : arrayLength > 0 ? 1 : 0,
lastItemNumber : this.filteredInCount
}];
this._changes = this._changes & !this.CHANGED_INITIAL_ARRAY; // don't add _CHANGED_PAGE_DATA because
// we did the job here
} | [
"function",
"(",
")",
"{",
"var",
"curState",
"=",
"this",
".",
"_currentState",
";",
"var",
"initialArray",
"=",
"this",
".",
"initialArray",
";",
"var",
"oldValues",
";",
"if",
"(",
"curState",
".",
"initialArray",
"==",
"initialArray",
"&&",
"!",
"(",
"this",
".",
"_changes",
"&",
"this",
".",
"CHANGED_INITIAL_ARRAY",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"curState",
".",
"initialArray",
")",
"{",
"oldValues",
"=",
"new",
"ariaUtilsStackHashMap",
"(",
")",
";",
"var",
"oldItems",
"=",
"this",
".",
"items",
";",
"var",
"oldItemsLength",
"=",
"oldItems",
".",
"length",
",",
"oldElt",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oldItemsLength",
";",
"i",
"++",
")",
"{",
"oldElt",
"=",
"oldItems",
"[",
"i",
"]",
";",
"oldValues",
".",
"push",
"(",
"oldElt",
".",
"value",
",",
"oldElt",
")",
";",
"}",
"}",
"if",
"(",
"ariaUtilsType",
".",
"isObject",
"(",
"initialArray",
")",
")",
"{",
"var",
"returnedItems",
"=",
"this",
".",
"_getItemsFromMap",
"(",
"oldValues",
")",
";",
"}",
"else",
"{",
"var",
"returnedItems",
"=",
"this",
".",
"_getItemsFromArray",
"(",
"oldValues",
")",
";",
"}",
"if",
"(",
"oldValues",
")",
"{",
"this",
".",
"_removeListenersOnItems",
"(",
"oldValues",
".",
"removeAll",
"(",
")",
")",
";",
"oldValues",
".",
"$dispose",
"(",
")",
";",
"}",
"this",
".",
"items",
"=",
"returnedItems",
".",
"items",
";",
"var",
"filteredOutElements",
"=",
"returnedItems",
".",
"filteredOutElements",
";",
"var",
"arrayLength",
"=",
"this",
".",
"items",
".",
"length",
";",
"curState",
".",
"initialArray",
"=",
"initialArray",
";",
"curState",
".",
"sortOrder",
"=",
"this",
".",
"SORT_INITIAL",
";",
"curState",
".",
"sortName",
"=",
"null",
";",
"curState",
".",
"sortKeyGetter",
"=",
"null",
";",
"curState",
".",
"pageSize",
"=",
"-",
"1",
";",
"this",
".",
"filteredInCount",
"=",
"arrayLength",
"-",
"filteredOutElements",
";",
"this",
".",
"pages",
"=",
"[",
"{",
"pageIndex",
":",
"0",
",",
"pageNumber",
":",
"1",
",",
"firstItemIndex",
":",
"0",
",",
"lastItemIndex",
":",
"arrayLength",
"-",
"1",
",",
"firstItemNumber",
":",
"arrayLength",
">",
"0",
"?",
"1",
":",
"0",
",",
"lastItemNumber",
":",
"this",
".",
"filteredInCount",
"}",
"]",
";",
"this",
".",
"_changes",
"=",
"this",
".",
"_changes",
"&",
"!",
"this",
".",
"CHANGED_INITIAL_ARRAY",
";",
"}"
]
| Creates this.items corresponding to this.initialArray. It reuses the current this.items elements if
possible.
@protected | [
"Creates",
"this",
".",
"items",
"corresponding",
"to",
"this",
".",
"initialArray",
".",
"It",
"reuses",
"the",
"current",
"this",
".",
"items",
"elements",
"if",
"possible",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L346-L393 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (oldValues) {
var initialArray = this.initialArray;
var items = [];
var filteredOutElements = 0;
var arrayLength = initialArray.length;
for (var i = 0; i < arrayLength; i++) {
var iaElt = initialArray[i];
var itemsElt = null;
if (oldValues) {
itemsElt = oldValues.pop(iaElt);
}
if (itemsElt == null) {
if (iaElt != null) {
itemsElt = {
value : iaElt,
initIndex : i,
filteredIn : true,
sortKey : null,
pageIndex : 0
};
json.addListener(itemsElt, "filteredIn", this._jsonChangeCallback, true);
} else {
// log an error if iaElt is undefined
this.$logError(this.UNDEFINED_ARRAY_ELEMENT);
}
} else {
itemsElt.pageIndex = 0;
}
if (itemsElt) {
items[i] = itemsElt;
if (!itemsElt.filteredIn) {
filteredOutElements++;
}
}
}
return {
items : items,
filteredOutElements : filteredOutElements
};
} | javascript | function (oldValues) {
var initialArray = this.initialArray;
var items = [];
var filteredOutElements = 0;
var arrayLength = initialArray.length;
for (var i = 0; i < arrayLength; i++) {
var iaElt = initialArray[i];
var itemsElt = null;
if (oldValues) {
itemsElt = oldValues.pop(iaElt);
}
if (itemsElt == null) {
if (iaElt != null) {
itemsElt = {
value : iaElt,
initIndex : i,
filteredIn : true,
sortKey : null,
pageIndex : 0
};
json.addListener(itemsElt, "filteredIn", this._jsonChangeCallback, true);
} else {
// log an error if iaElt is undefined
this.$logError(this.UNDEFINED_ARRAY_ELEMENT);
}
} else {
itemsElt.pageIndex = 0;
}
if (itemsElt) {
items[i] = itemsElt;
if (!itemsElt.filteredIn) {
filteredOutElements++;
}
}
}
return {
items : items,
filteredOutElements : filteredOutElements
};
} | [
"function",
"(",
"oldValues",
")",
"{",
"var",
"initialArray",
"=",
"this",
".",
"initialArray",
";",
"var",
"items",
"=",
"[",
"]",
";",
"var",
"filteredOutElements",
"=",
"0",
";",
"var",
"arrayLength",
"=",
"initialArray",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arrayLength",
";",
"i",
"++",
")",
"{",
"var",
"iaElt",
"=",
"initialArray",
"[",
"i",
"]",
";",
"var",
"itemsElt",
"=",
"null",
";",
"if",
"(",
"oldValues",
")",
"{",
"itemsElt",
"=",
"oldValues",
".",
"pop",
"(",
"iaElt",
")",
";",
"}",
"if",
"(",
"itemsElt",
"==",
"null",
")",
"{",
"if",
"(",
"iaElt",
"!=",
"null",
")",
"{",
"itemsElt",
"=",
"{",
"value",
":",
"iaElt",
",",
"initIndex",
":",
"i",
",",
"filteredIn",
":",
"true",
",",
"sortKey",
":",
"null",
",",
"pageIndex",
":",
"0",
"}",
";",
"json",
".",
"addListener",
"(",
"itemsElt",
",",
"\"filteredIn\"",
",",
"this",
".",
"_jsonChangeCallback",
",",
"true",
")",
";",
"}",
"else",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"UNDEFINED_ARRAY_ELEMENT",
")",
";",
"}",
"}",
"else",
"{",
"itemsElt",
".",
"pageIndex",
"=",
"0",
";",
"}",
"if",
"(",
"itemsElt",
")",
"{",
"items",
"[",
"i",
"]",
"=",
"itemsElt",
";",
"if",
"(",
"!",
"itemsElt",
".",
"filteredIn",
")",
"{",
"filteredOutElements",
"++",
";",
"}",
"}",
"}",
"return",
"{",
"items",
":",
"items",
",",
"filteredOutElements",
":",
"filteredOutElements",
"}",
";",
"}"
]
| Build the items array starting from the initial array and taking into account the items that are already
present in the items array of the view
@protected
@param {aria.utils.StackHashMap} oldValues map of the items that are already present in the items array,
indexed by item value
@return {Object} contains the items array and the number of elements that are filtered out | [
"Build",
"the",
"items",
"array",
"starting",
"from",
"the",
"initial",
"array",
"and",
"taking",
"into",
"account",
"the",
"items",
"that",
"are",
"already",
"present",
"in",
"the",
"items",
"array",
"of",
"the",
"view"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L403-L445 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (oldValues) {
var j = 0, items = [], filteredOutElements = 0;
var initialArray = this.initialArray;
for (var p in initialArray) {
if (initialArray.hasOwnProperty(p) && !json.isMetadata(p)) {
var iaElt = initialArray[p];
var itemsElt = null;
if (oldValues) {
itemsElt = oldValues.pop(iaElt);
}
if (itemsElt == null) {
itemsElt = {
value : iaElt,
initIndex : p,
filteredIn : true,
sortKey : null,
pageIndex : 0
};
json.addListener(itemsElt, "filteredIn", this._jsonChangeCallback, true);
} else {
itemsElt.pageIndex = 0;
}
items[j] = itemsElt;
if (!itemsElt.filteredIn) {
filteredOutElements++;
}
j++;
}
}
return {
items : items,
filteredOutElements : filteredOutElements
};
} | javascript | function (oldValues) {
var j = 0, items = [], filteredOutElements = 0;
var initialArray = this.initialArray;
for (var p in initialArray) {
if (initialArray.hasOwnProperty(p) && !json.isMetadata(p)) {
var iaElt = initialArray[p];
var itemsElt = null;
if (oldValues) {
itemsElt = oldValues.pop(iaElt);
}
if (itemsElt == null) {
itemsElt = {
value : iaElt,
initIndex : p,
filteredIn : true,
sortKey : null,
pageIndex : 0
};
json.addListener(itemsElt, "filteredIn", this._jsonChangeCallback, true);
} else {
itemsElt.pageIndex = 0;
}
items[j] = itemsElt;
if (!itemsElt.filteredIn) {
filteredOutElements++;
}
j++;
}
}
return {
items : items,
filteredOutElements : filteredOutElements
};
} | [
"function",
"(",
"oldValues",
")",
"{",
"var",
"j",
"=",
"0",
",",
"items",
"=",
"[",
"]",
",",
"filteredOutElements",
"=",
"0",
";",
"var",
"initialArray",
"=",
"this",
".",
"initialArray",
";",
"for",
"(",
"var",
"p",
"in",
"initialArray",
")",
"{",
"if",
"(",
"initialArray",
".",
"hasOwnProperty",
"(",
"p",
")",
"&&",
"!",
"json",
".",
"isMetadata",
"(",
"p",
")",
")",
"{",
"var",
"iaElt",
"=",
"initialArray",
"[",
"p",
"]",
";",
"var",
"itemsElt",
"=",
"null",
";",
"if",
"(",
"oldValues",
")",
"{",
"itemsElt",
"=",
"oldValues",
".",
"pop",
"(",
"iaElt",
")",
";",
"}",
"if",
"(",
"itemsElt",
"==",
"null",
")",
"{",
"itemsElt",
"=",
"{",
"value",
":",
"iaElt",
",",
"initIndex",
":",
"p",
",",
"filteredIn",
":",
"true",
",",
"sortKey",
":",
"null",
",",
"pageIndex",
":",
"0",
"}",
";",
"json",
".",
"addListener",
"(",
"itemsElt",
",",
"\"filteredIn\"",
",",
"this",
".",
"_jsonChangeCallback",
",",
"true",
")",
";",
"}",
"else",
"{",
"itemsElt",
".",
"pageIndex",
"=",
"0",
";",
"}",
"items",
"[",
"j",
"]",
"=",
"itemsElt",
";",
"if",
"(",
"!",
"itemsElt",
".",
"filteredIn",
")",
"{",
"filteredOutElements",
"++",
";",
"}",
"j",
"++",
";",
"}",
"}",
"return",
"{",
"items",
":",
"items",
",",
"filteredOutElements",
":",
"filteredOutElements",
"}",
";",
"}"
]
| Build the items array starting from the initial map and taking into account the items that are already
present in the items array of the view
@protected
@param {aria.utils.StackHashMap} oldValues map of the items that are already present in the items array,
indexed by item value
@return {Object} contains the items array and the number of elements that are filtered out | [
"Build",
"the",
"items",
"array",
"starting",
"from",
"the",
"initial",
"map",
"and",
"taking",
"into",
"account",
"the",
"items",
"that",
"are",
"already",
"present",
"in",
"the",
"items",
"array",
"of",
"the",
"view"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L455-L490 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function () {
var oldItems = this.items;
var oldItemsLength = oldItems.length;
var newItems = [];
var initialArray = this.initialArray;
if (ariaUtilsType.isObject(initialArray)) {
var oldItemsMap = new ariaUtilsStackHashMap();
var oldElt;
for (var i = 0; i < oldItemsLength; i++) {
oldElt = oldItems[i];
oldItemsMap.push(oldElt.value, oldElt);
}
var j = 0;
for (var p in initialArray) {
if (initialArray.hasOwnProperty(p) && !json.isMetadata(p)) {
newItems[j] = oldItemsMap.pop(initialArray[p]);
j++;
}
}
oldItemsMap.$dispose();
} else {
for (var i = 0; i < oldItemsLength; i++) {
var elt = oldItems[i];
newItems[elt.initIndex] = elt;
delete oldItems[i];
}
}
this.items = newItems;
var curState = this._currentState;
curState.sortOrder = this.SORT_INITIAL;
curState.sortName = null;
curState.sortKeyGetter = null;
this._changes = this._changes | this._CHANGED_PAGE_DATA;
} | javascript | function () {
var oldItems = this.items;
var oldItemsLength = oldItems.length;
var newItems = [];
var initialArray = this.initialArray;
if (ariaUtilsType.isObject(initialArray)) {
var oldItemsMap = new ariaUtilsStackHashMap();
var oldElt;
for (var i = 0; i < oldItemsLength; i++) {
oldElt = oldItems[i];
oldItemsMap.push(oldElt.value, oldElt);
}
var j = 0;
for (var p in initialArray) {
if (initialArray.hasOwnProperty(p) && !json.isMetadata(p)) {
newItems[j] = oldItemsMap.pop(initialArray[p]);
j++;
}
}
oldItemsMap.$dispose();
} else {
for (var i = 0; i < oldItemsLength; i++) {
var elt = oldItems[i];
newItems[elt.initIndex] = elt;
delete oldItems[i];
}
}
this.items = newItems;
var curState = this._currentState;
curState.sortOrder = this.SORT_INITIAL;
curState.sortName = null;
curState.sortKeyGetter = null;
this._changes = this._changes | this._CHANGED_PAGE_DATA;
} | [
"function",
"(",
")",
"{",
"var",
"oldItems",
"=",
"this",
".",
"items",
";",
"var",
"oldItemsLength",
"=",
"oldItems",
".",
"length",
";",
"var",
"newItems",
"=",
"[",
"]",
";",
"var",
"initialArray",
"=",
"this",
".",
"initialArray",
";",
"if",
"(",
"ariaUtilsType",
".",
"isObject",
"(",
"initialArray",
")",
")",
"{",
"var",
"oldItemsMap",
"=",
"new",
"ariaUtilsStackHashMap",
"(",
")",
";",
"var",
"oldElt",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oldItemsLength",
";",
"i",
"++",
")",
"{",
"oldElt",
"=",
"oldItems",
"[",
"i",
"]",
";",
"oldItemsMap",
".",
"push",
"(",
"oldElt",
".",
"value",
",",
"oldElt",
")",
";",
"}",
"var",
"j",
"=",
"0",
";",
"for",
"(",
"var",
"p",
"in",
"initialArray",
")",
"{",
"if",
"(",
"initialArray",
".",
"hasOwnProperty",
"(",
"p",
")",
"&&",
"!",
"json",
".",
"isMetadata",
"(",
"p",
")",
")",
"{",
"newItems",
"[",
"j",
"]",
"=",
"oldItemsMap",
".",
"pop",
"(",
"initialArray",
"[",
"p",
"]",
")",
";",
"j",
"++",
";",
"}",
"}",
"oldItemsMap",
".",
"$dispose",
"(",
")",
";",
"}",
"else",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oldItemsLength",
";",
"i",
"++",
")",
"{",
"var",
"elt",
"=",
"oldItems",
"[",
"i",
"]",
";",
"newItems",
"[",
"elt",
".",
"initIndex",
"]",
"=",
"elt",
";",
"delete",
"oldItems",
"[",
"i",
"]",
";",
"}",
"}",
"this",
".",
"items",
"=",
"newItems",
";",
"var",
"curState",
"=",
"this",
".",
"_currentState",
";",
"curState",
".",
"sortOrder",
"=",
"this",
".",
"SORT_INITIAL",
";",
"curState",
".",
"sortName",
"=",
"null",
";",
"curState",
".",
"sortKeyGetter",
"=",
"null",
";",
"this",
".",
"_changes",
"=",
"this",
".",
"_changes",
"|",
"this",
".",
"_CHANGED_PAGE_DATA",
";",
"}"
]
| Reset this.items to match the order of the initial array or map.
@protected | [
"Reset",
"this",
".",
"items",
"to",
"match",
"the",
"order",
"of",
"the",
"initial",
"array",
"or",
"map",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L496-L532 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function () {
var sortKeyGetter = this.sortKeyGetter;
var items = this.items;
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
var elt = items[i];
elt.sortKey = sortKeyGetter.fn.call(sortKeyGetter.scope, elt, sortKeyGetter.args);
}
items.sort(this.sortOrder == this.SORT_ASCENDING
? __ascendingSortingFunction
: __descendingSortingFunction);
var curState = this._currentState;
curState.sortKeyGetter = this.sortKeyGetter;
curState.sortOrder = this.sortOrder;
curState.sortName = this.sortName;
this._changes = this._changes | this._CHANGED_PAGE_DATA;
} | javascript | function () {
var sortKeyGetter = this.sortKeyGetter;
var items = this.items;
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
var elt = items[i];
elt.sortKey = sortKeyGetter.fn.call(sortKeyGetter.scope, elt, sortKeyGetter.args);
}
items.sort(this.sortOrder == this.SORT_ASCENDING
? __ascendingSortingFunction
: __descendingSortingFunction);
var curState = this._currentState;
curState.sortKeyGetter = this.sortKeyGetter;
curState.sortOrder = this.sortOrder;
curState.sortName = this.sortName;
this._changes = this._changes | this._CHANGED_PAGE_DATA;
} | [
"function",
"(",
")",
"{",
"var",
"sortKeyGetter",
"=",
"this",
".",
"sortKeyGetter",
";",
"var",
"items",
"=",
"this",
".",
"items",
";",
"var",
"itemsLength",
"=",
"items",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"itemsLength",
";",
"i",
"++",
")",
"{",
"var",
"elt",
"=",
"items",
"[",
"i",
"]",
";",
"elt",
".",
"sortKey",
"=",
"sortKeyGetter",
".",
"fn",
".",
"call",
"(",
"sortKeyGetter",
".",
"scope",
",",
"elt",
",",
"sortKeyGetter",
".",
"args",
")",
";",
"}",
"items",
".",
"sort",
"(",
"this",
".",
"sortOrder",
"==",
"this",
".",
"SORT_ASCENDING",
"?",
"__ascendingSortingFunction",
":",
"__descendingSortingFunction",
")",
";",
"var",
"curState",
"=",
"this",
".",
"_currentState",
";",
"curState",
".",
"sortKeyGetter",
"=",
"this",
".",
"sortKeyGetter",
";",
"curState",
".",
"sortOrder",
"=",
"this",
".",
"sortOrder",
";",
"curState",
".",
"sortName",
"=",
"this",
".",
"sortName",
";",
"this",
".",
"_changes",
"=",
"this",
".",
"_changes",
"|",
"this",
".",
"_CHANGED_PAGE_DATA",
";",
"}"
]
| Sort this.items according to this.sortKeyGetter and this.sortOrder. Should not be called if
this.sortOrder == this.SORT_INITIAL. Call _resetSortOrder instead.
@protected | [
"Sort",
"this",
".",
"items",
"according",
"to",
"this",
".",
"sortKeyGetter",
"and",
"this",
".",
"sortOrder",
".",
"Should",
"not",
"be",
"called",
"if",
"this",
".",
"sortOrder",
"==",
"this",
".",
"SORT_INITIAL",
".",
"Call",
"_resetSortOrder",
"instead",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L539-L555 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function () {
var items = this.items;
var itemsLength = items.length;
var pageSize = this.pageSize;
if (pageSize <= 0) {
pageSize = -1;
}
var pages = [], pageLength = 0;
var pageIndex = 0;
var nbElementsInPage = 0;
var firstElement = -1;
for (var i = 0; i < itemsLength; i++) {
var elt = items[i];
if (elt.filteredIn) {
if (nbElementsInPage === 0) {
firstElement = i;
}
nbElementsInPage++;
elt.pageIndex = pageIndex;
if (nbElementsInPage == pageSize) {
pages[pageLength++] = {
pageIndex : pageIndex,
pageNumber : pageIndex + 1,
firstItemIndex : firstElement,
lastItemIndex : i,
firstItemNumber : pageIndex * pageSize + 1,
lastItemNumber : (pageIndex + 1) * pageSize
};
pageIndex++;
nbElementsInPage = 0;
}
} else {
elt.pageIndex = -1;
}
}
this._currentState.pageSize = pageSize;
this.pageMode = (pageSize > 0);
this.filteredInCount = pageIndex * pageSize + nbElementsInPage; // true even when pageMode == false (as
// pageIndex == 0)
if (nbElementsInPage > 0) {
pages[pageLength++] = {
pageIndex : pageIndex,
pageNumber : pageIndex + 1,
firstItemIndex : firstElement,
lastItemIndex : itemsLength - 1,
firstItemNumber : pageIndex * pageSize + 1,
lastItemNumber : this.filteredInCount
};
}
if (pageLength === 0) {
// there always must be at least one page
pages = this.EMPTY_PAGES;
}
this.pages = pages;
} | javascript | function () {
var items = this.items;
var itemsLength = items.length;
var pageSize = this.pageSize;
if (pageSize <= 0) {
pageSize = -1;
}
var pages = [], pageLength = 0;
var pageIndex = 0;
var nbElementsInPage = 0;
var firstElement = -1;
for (var i = 0; i < itemsLength; i++) {
var elt = items[i];
if (elt.filteredIn) {
if (nbElementsInPage === 0) {
firstElement = i;
}
nbElementsInPage++;
elt.pageIndex = pageIndex;
if (nbElementsInPage == pageSize) {
pages[pageLength++] = {
pageIndex : pageIndex,
pageNumber : pageIndex + 1,
firstItemIndex : firstElement,
lastItemIndex : i,
firstItemNumber : pageIndex * pageSize + 1,
lastItemNumber : (pageIndex + 1) * pageSize
};
pageIndex++;
nbElementsInPage = 0;
}
} else {
elt.pageIndex = -1;
}
}
this._currentState.pageSize = pageSize;
this.pageMode = (pageSize > 0);
this.filteredInCount = pageIndex * pageSize + nbElementsInPage; // true even when pageMode == false (as
// pageIndex == 0)
if (nbElementsInPage > 0) {
pages[pageLength++] = {
pageIndex : pageIndex,
pageNumber : pageIndex + 1,
firstItemIndex : firstElement,
lastItemIndex : itemsLength - 1,
firstItemNumber : pageIndex * pageSize + 1,
lastItemNumber : this.filteredInCount
};
}
if (pageLength === 0) {
// there always must be at least one page
pages = this.EMPTY_PAGES;
}
this.pages = pages;
} | [
"function",
"(",
")",
"{",
"var",
"items",
"=",
"this",
".",
"items",
";",
"var",
"itemsLength",
"=",
"items",
".",
"length",
";",
"var",
"pageSize",
"=",
"this",
".",
"pageSize",
";",
"if",
"(",
"pageSize",
"<=",
"0",
")",
"{",
"pageSize",
"=",
"-",
"1",
";",
"}",
"var",
"pages",
"=",
"[",
"]",
",",
"pageLength",
"=",
"0",
";",
"var",
"pageIndex",
"=",
"0",
";",
"var",
"nbElementsInPage",
"=",
"0",
";",
"var",
"firstElement",
"=",
"-",
"1",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"itemsLength",
";",
"i",
"++",
")",
"{",
"var",
"elt",
"=",
"items",
"[",
"i",
"]",
";",
"if",
"(",
"elt",
".",
"filteredIn",
")",
"{",
"if",
"(",
"nbElementsInPage",
"===",
"0",
")",
"{",
"firstElement",
"=",
"i",
";",
"}",
"nbElementsInPage",
"++",
";",
"elt",
".",
"pageIndex",
"=",
"pageIndex",
";",
"if",
"(",
"nbElementsInPage",
"==",
"pageSize",
")",
"{",
"pages",
"[",
"pageLength",
"++",
"]",
"=",
"{",
"pageIndex",
":",
"pageIndex",
",",
"pageNumber",
":",
"pageIndex",
"+",
"1",
",",
"firstItemIndex",
":",
"firstElement",
",",
"lastItemIndex",
":",
"i",
",",
"firstItemNumber",
":",
"pageIndex",
"*",
"pageSize",
"+",
"1",
",",
"lastItemNumber",
":",
"(",
"pageIndex",
"+",
"1",
")",
"*",
"pageSize",
"}",
";",
"pageIndex",
"++",
";",
"nbElementsInPage",
"=",
"0",
";",
"}",
"}",
"else",
"{",
"elt",
".",
"pageIndex",
"=",
"-",
"1",
";",
"}",
"}",
"this",
".",
"_currentState",
".",
"pageSize",
"=",
"pageSize",
";",
"this",
".",
"pageMode",
"=",
"(",
"pageSize",
">",
"0",
")",
";",
"this",
".",
"filteredInCount",
"=",
"pageIndex",
"*",
"pageSize",
"+",
"nbElementsInPage",
";",
"if",
"(",
"nbElementsInPage",
">",
"0",
")",
"{",
"pages",
"[",
"pageLength",
"++",
"]",
"=",
"{",
"pageIndex",
":",
"pageIndex",
",",
"pageNumber",
":",
"pageIndex",
"+",
"1",
",",
"firstItemIndex",
":",
"firstElement",
",",
"lastItemIndex",
":",
"itemsLength",
"-",
"1",
",",
"firstItemNumber",
":",
"pageIndex",
"*",
"pageSize",
"+",
"1",
",",
"lastItemNumber",
":",
"this",
".",
"filteredInCount",
"}",
";",
"}",
"if",
"(",
"pageLength",
"===",
"0",
")",
"{",
"pages",
"=",
"this",
".",
"EMPTY_PAGES",
";",
"}",
"this",
".",
"pages",
"=",
"pages",
";",
"}"
]
| Build this.pages array.
@protected | [
"Build",
"this",
".",
"pages",
"array",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L561-L615 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (filteredIn) {
if (filteredIn == null) {
filteredIn = true;
}
// if not already done, we must first refresh the initial array before marking all elements:
this._refreshInitialArray();
var items = this.items;
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
json.setValue(items[i], "filteredIn", filteredIn, this._jsonChangeCallback);
}
this.notifyChange(this._CHANGED_FILTERED_IN);
} | javascript | function (filteredIn) {
if (filteredIn == null) {
filteredIn = true;
}
// if not already done, we must first refresh the initial array before marking all elements:
this._refreshInitialArray();
var items = this.items;
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
json.setValue(items[i], "filteredIn", filteredIn, this._jsonChangeCallback);
}
this.notifyChange(this._CHANGED_FILTERED_IN);
} | [
"function",
"(",
"filteredIn",
")",
"{",
"if",
"(",
"filteredIn",
"==",
"null",
")",
"{",
"filteredIn",
"=",
"true",
";",
"}",
"this",
".",
"_refreshInitialArray",
"(",
")",
";",
"var",
"items",
"=",
"this",
".",
"items",
";",
"var",
"itemsLength",
"=",
"items",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"itemsLength",
";",
"i",
"++",
")",
"{",
"json",
".",
"setValue",
"(",
"items",
"[",
"i",
"]",
",",
"\"filteredIn\"",
",",
"filteredIn",
",",
"this",
".",
"_jsonChangeCallback",
")",
";",
"}",
"this",
".",
"notifyChange",
"(",
"this",
".",
"_CHANGED_FILTERED_IN",
")",
";",
"}"
]
| Filter in all elements.
@param {Boolean} filteredIn [optional, default: true] If true, filter in all elements. If false, filter
out all elements. | [
"Filter",
"in",
"all",
"elements",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L622-L634 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (filterType, filterCallback) {
// normalize callback only once
filterCallback = this.$normCallback(filterCallback);
var filterFn = filterCallback.fn, filterScope = filterCallback.scope;
// if not already done, we must first refresh the initial array before marking all elements:
this._refreshInitialArray();
var items = this.items;
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
var elt = items[i];
var filteredIn = elt.filteredIn;
if (filterType == this.FILTER_SET || (filteredIn === (filterType == this.FILTER_REMOVE))) {
filteredIn = filterFn.call(filterScope, elt, filterCallback.args);
json.setValue(elt, "filteredIn", filteredIn);
}
}
} | javascript | function (filterType, filterCallback) {
// normalize callback only once
filterCallback = this.$normCallback(filterCallback);
var filterFn = filterCallback.fn, filterScope = filterCallback.scope;
// if not already done, we must first refresh the initial array before marking all elements:
this._refreshInitialArray();
var items = this.items;
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
var elt = items[i];
var filteredIn = elt.filteredIn;
if (filterType == this.FILTER_SET || (filteredIn === (filterType == this.FILTER_REMOVE))) {
filteredIn = filterFn.call(filterScope, elt, filterCallback.args);
json.setValue(elt, "filteredIn", filteredIn);
}
}
} | [
"function",
"(",
"filterType",
",",
"filterCallback",
")",
"{",
"filterCallback",
"=",
"this",
".",
"$normCallback",
"(",
"filterCallback",
")",
";",
"var",
"filterFn",
"=",
"filterCallback",
".",
"fn",
",",
"filterScope",
"=",
"filterCallback",
".",
"scope",
";",
"this",
".",
"_refreshInitialArray",
"(",
")",
";",
"var",
"items",
"=",
"this",
".",
"items",
";",
"var",
"itemsLength",
"=",
"items",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"itemsLength",
";",
"i",
"++",
")",
"{",
"var",
"elt",
"=",
"items",
"[",
"i",
"]",
";",
"var",
"filteredIn",
"=",
"elt",
".",
"filteredIn",
";",
"if",
"(",
"filterType",
"==",
"this",
".",
"FILTER_SET",
"||",
"(",
"filteredIn",
"===",
"(",
"filterType",
"==",
"this",
".",
"FILTER_REMOVE",
")",
")",
")",
"{",
"filteredIn",
"=",
"filterFn",
".",
"call",
"(",
"filterScope",
",",
"elt",
",",
"filterCallback",
".",
"args",
")",
";",
"json",
".",
"setValue",
"(",
"elt",
",",
"\"filteredIn\"",
",",
"filteredIn",
")",
";",
"}",
"}",
"}"
]
| Filters the items with a callback function called on each element. Does not refresh the view.
@param {Integer} filterType Can be either FILTER_SET (in this case, filterCallback will be called on all elements
whether they are filtered in or not), FILTER_ADD (filterCallback will only be called on filtered out
elements, so that it can only add elements to the current display) or FILTER_REMOVE (filterCallback will
only be called on filtered in elements, so that it can only remove elements from the current display).
@param {aria.core.CfgBeans:Callback} filterCallback Callback which will be called on each item. The
callback must return either true or false, which will be the new value of the filteredIn property of the
element. | [
"Filters",
"the",
"items",
"with",
"a",
"callback",
"function",
"called",
"on",
"each",
"element",
".",
"Does",
"not",
"refresh",
"the",
"view",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L714-L730 | train |
|
ariatemplates/ariatemplates | src/aria/templates/View.js | function (array) {
if (!(ariaUtilsType.isObject(array) || ariaUtilsType.isArray(array))) {
this.$logError(this.INVALID_TYPE_OF_ARGUMENT);
return;
}
this.initialArray = array;
this._refreshInitialArray();
} | javascript | function (array) {
if (!(ariaUtilsType.isObject(array) || ariaUtilsType.isArray(array))) {
this.$logError(this.INVALID_TYPE_OF_ARGUMENT);
return;
}
this.initialArray = array;
this._refreshInitialArray();
} | [
"function",
"(",
"array",
")",
"{",
"if",
"(",
"!",
"(",
"ariaUtilsType",
".",
"isObject",
"(",
"array",
")",
"||",
"ariaUtilsType",
".",
"isArray",
"(",
"array",
")",
")",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_TYPE_OF_ARGUMENT",
")",
";",
"return",
";",
"}",
"this",
".",
"initialArray",
"=",
"array",
";",
"this",
".",
"_refreshInitialArray",
"(",
")",
";",
"}"
]
| Updates initial array of the view. Needed in case where the previous initial array is replaced by another object
@param {Array|Object} new obj array or map on which to create the view | [
"Updates",
"initial",
"array",
"of",
"the",
"view",
".",
"Needed",
"in",
"case",
"where",
"the",
"previous",
"initial",
"array",
"is",
"replaced",
"by",
"another",
"object"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/View.js#L746-L753 | train |
|
ariatemplates/ariatemplates | src/aria/core/Interfaces.js | function (instances) {
var r = 10000000 * Math.random(); // todo: could be replaced with algo generating keys with numbers and
// letters
var key = '' + (r | r); // r|r = equivalent to Math.floor - but faster in old browsers
while (instances[key]) {
key += 'x';
}
return key;
} | javascript | function (instances) {
var r = 10000000 * Math.random(); // todo: could be replaced with algo generating keys with numbers and
// letters
var key = '' + (r | r); // r|r = equivalent to Math.floor - but faster in old browsers
while (instances[key]) {
key += 'x';
}
return key;
} | [
"function",
"(",
"instances",
")",
"{",
"var",
"r",
"=",
"10000000",
"*",
"Math",
".",
"random",
"(",
")",
";",
"var",
"key",
"=",
"''",
"+",
"(",
"r",
"|",
"r",
")",
";",
"while",
"(",
"instances",
"[",
"key",
"]",
")",
"{",
"key",
"+=",
"'x'",
";",
"}",
"return",
"key",
";",
"}"
]
| Generate a key that does not exist in the given object.
@param {Object} instances Object for which a non-existent key must be generated.
@return {String|Number} key which does not exist in instances.
@private | [
"Generate",
"a",
"key",
"that",
"does",
"not",
"exist",
"in",
"the",
"given",
"object",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Interfaces.js#L36-L44 | train |
|
ariatemplates/ariatemplates | src/aria/core/Interfaces.js | function (def, classpath, member) {
var res;
if (typeUtils.isFunction(def)) {
// should already be normalized:
return __simpleFunctionDefinition;
} else if (typeUtils.isString(def)) {
res = {
$type : def
};
} else if (typeUtils.isArray(def)) {
return __simpleArrayDefinition;
} else if (typeUtils.isObject(def)) {
res = def;
} else {
return null;
}
var memberType = res.$type;
if (!__acceptedMemberTypes[memberType]) {
// the error is logged later
return null;
}
if (!(require("./JsonValidator")).normalize({
json : res,
beanName : "aria.core.CfgBeans.ItfMember" + memberType + "Cfg"
})) {
return null;
}
return res;
} | javascript | function (def, classpath, member) {
var res;
if (typeUtils.isFunction(def)) {
// should already be normalized:
return __simpleFunctionDefinition;
} else if (typeUtils.isString(def)) {
res = {
$type : def
};
} else if (typeUtils.isArray(def)) {
return __simpleArrayDefinition;
} else if (typeUtils.isObject(def)) {
res = def;
} else {
return null;
}
var memberType = res.$type;
if (!__acceptedMemberTypes[memberType]) {
// the error is logged later
return null;
}
if (!(require("./JsonValidator")).normalize({
json : res,
beanName : "aria.core.CfgBeans.ItfMember" + memberType + "Cfg"
})) {
return null;
}
return res;
} | [
"function",
"(",
"def",
",",
"classpath",
",",
"member",
")",
"{",
"var",
"res",
";",
"if",
"(",
"typeUtils",
".",
"isFunction",
"(",
"def",
")",
")",
"{",
"return",
"__simpleFunctionDefinition",
";",
"}",
"else",
"if",
"(",
"typeUtils",
".",
"isString",
"(",
"def",
")",
")",
"{",
"res",
"=",
"{",
"$type",
":",
"def",
"}",
";",
"}",
"else",
"if",
"(",
"typeUtils",
".",
"isArray",
"(",
"def",
")",
")",
"{",
"return",
"__simpleArrayDefinition",
";",
"}",
"else",
"if",
"(",
"typeUtils",
".",
"isObject",
"(",
"def",
")",
")",
"{",
"res",
"=",
"def",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"var",
"memberType",
"=",
"res",
".",
"$type",
";",
"if",
"(",
"!",
"__acceptedMemberTypes",
"[",
"memberType",
"]",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"(",
"require",
"(",
"\"./JsonValidator\"",
")",
")",
".",
"normalize",
"(",
"{",
"json",
":",
"res",
",",
"beanName",
":",
"\"aria.core.CfgBeans.ItfMember\"",
"+",
"memberType",
"+",
"\"Cfg\"",
"}",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"res",
";",
"}"
]
| Normalize interface member definition in the interface.
@param {String|Function|Object|Array} Interface member definition.
@return {Object} json object containing at least the $type property.
@private | [
"Normalize",
"interface",
"member",
"definition",
"in",
"the",
"interface",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Interfaces.js#L104-L132 | train |
|
ariatemplates/ariatemplates | src/aria/core/Interfaces.js | function (src) {
var res = {};
for (var k in src) {
if (src.hasOwnProperty(k)) {
res[k] = src[k];
}
}
return res;
} | javascript | function (src) {
var res = {};
for (var k in src) {
if (src.hasOwnProperty(k)) {
res[k] = src[k];
}
}
return res;
} | [
"function",
"(",
"src",
")",
"{",
"var",
"res",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"k",
"in",
"src",
")",
"{",
"if",
"(",
"src",
".",
"hasOwnProperty",
"(",
"k",
")",
")",
"{",
"res",
"[",
"k",
"]",
"=",
"src",
"[",
"k",
"]",
";",
"}",
"}",
"return",
"res",
";",
"}"
]
| Simple 1 level copy of a map.
@param {Object}
@return {Object} | [
"Simple",
"1",
"level",
"copy",
"of",
"a",
"map",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/Interfaces.js#L139-L147 | train |
|
ariatemplates/ariatemplates | src/aria/utils/DomNavigationManager.js | sliceArguments | function sliceArguments(args, startIndex) {
if (startIndex == null) {
startIndex = 0;
}
return Array.prototype.slice.call(args, startIndex);
} | javascript | function sliceArguments(args, startIndex) {
if (startIndex == null) {
startIndex = 0;
}
return Array.prototype.slice.call(args, startIndex);
} | [
"function",
"sliceArguments",
"(",
"args",
",",
"startIndex",
")",
"{",
"if",
"(",
"startIndex",
"==",
"null",
")",
"{",
"startIndex",
"=",
"0",
";",
"}",
"return",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"args",
",",
"startIndex",
")",
";",
"}"
]
| Turns all or part of the "arguments" of a function into an array. An optional start index can be specified, for the common use case of "splat args".
@param {Arguments} args The arguments of a function
@param {Number} startIndex An optional index at which to start the copy of the arguments; defaults to 0
@return {Array} The copy of the arguments | [
"Turns",
"all",
"or",
"part",
"of",
"the",
"arguments",
"of",
"a",
"function",
"into",
"an",
"array",
".",
"An",
"optional",
"start",
"index",
"can",
"be",
"specified",
"for",
"the",
"common",
"use",
"case",
"of",
"splat",
"args",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/DomNavigationManager.js#L79-L85 | train |
ariatemplates/ariatemplates | src/aria/utils/DomNavigationManager.js | createHiddenElement | function createHiddenElement() {
// -------------------------------------------------------------- properties
var element = document.createElement('div');
var style = element.style;
style.width = 0;
style.height = 0;
element.setAttribute('aria-hidden', 'true');
// ------------------------------------------------------------------ return
return element;
} | javascript | function createHiddenElement() {
// -------------------------------------------------------------- properties
var element = document.createElement('div');
var style = element.style;
style.width = 0;
style.height = 0;
element.setAttribute('aria-hidden', 'true');
// ------------------------------------------------------------------ return
return element;
} | [
"function",
"createHiddenElement",
"(",
")",
"{",
"var",
"element",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"var",
"style",
"=",
"element",
".",
"style",
";",
"style",
".",
"width",
"=",
"0",
";",
"style",
".",
"height",
"=",
"0",
";",
"element",
".",
"setAttribute",
"(",
"'aria-hidden'",
",",
"'true'",
")",
";",
"return",
"element",
";",
"}"
]
| Creates a DOM element that is not visible.
<p>
It uses a technique that doesn't prevent the element from being focused.
</p>
<p>
It also respects accessibility by setting aria-hidden to true.
</p>
@return {HTMLElement} The created element. | [
"Creates",
"a",
"DOM",
"element",
"that",
"is",
"not",
"visible",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/DomNavigationManager.js#L263-L277 | train |
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (args) {
if (!this._cfg) {
//template has been disposed no need to refresh
return;
}
if (ariaTemplatesRefreshManager.isStopped()) {
// look for the section to be refreshed, and notify it:
if (args) {
var sectionToRefresh = args.section;
if (sectionToRefresh && this._mainSection) {
var section = this._mainSection.getSectionById(sectionToRefresh);
if (section) {
section.notifyRefreshPlanned(args);
return;
}
}
}
ariaTemplatesRefreshManager.queue({
fn : this.$refresh,
args : args,
scope : this
}, this);
} else {
if (!this._cfg.tplDiv) {
// this can happen if calling $refresh before linkToPreviousMarkup is called
// (for example: including a sub-template which is already in the cache, and calling refresh in
// the onModuleEvent of the sub-template with no condition in the template script)
this.$logError(this.TEMPLATE_NOT_READY_FOR_REFRESH, [this.tplClasspath]);
return;
}
if (this._refreshing) {
this.$logError(this.ALREADY_REFRESHING, [this.tplClasspath]);
// TODO: call return when backward compatibility is removed
}
this._refreshing = true;
// PROFILING // var profilingId = this.$startMeasure("Refreshing " + this.tplClasspath);
// stopping the refresh manager ensure that what we are doing now will not impact elements that will
// be disposed
ariaTemplatesRefreshManager.stop();
// stopping the CSS Manager as weel to avoid refreshing it every time we create a widget
ariaTemplatesCSSMgr.stop();
this.$assert(304, !!this._tpl); // CSS dependencies
var validatorParam = {
json : args,
beanName : "aria.templates.CfgBeans.RefreshCfg"
};
ariaCoreJsonValidator.normalize(validatorParam);
args = validatorParam.json;
// call the $beforeRefresh if defined in the script associated to the template
this.beforeRefresh(args);
var section = this.getRefreshedSection({
section : args.section,
macro : args.macro
});
// Before removing the content from the DOM dispose any processing indicators to avoid leaks
this.__disposeProcessingIndicators();
// Inserting a section will add the html in the page, resume the CSSMgr before
ariaTemplatesCSSMgr.resume();
if (section != null) {
this.insertSection(section, false, args);
}
this._refreshing = false;
// PROFILING // this.$stopMeasure(profilingId);
// restaure refresh manager
ariaTemplatesRefreshManager.resume();
// WARNING: this must always be the last thing to do
if (section != null) {
// call the $afterRefresh if defined in the script associated to the template
this.afterRefresh(args);
this.$raiseEvent({
name : "SectionRefreshed",
sectionID : section.id
});
}
}
} | javascript | function (args) {
if (!this._cfg) {
//template has been disposed no need to refresh
return;
}
if (ariaTemplatesRefreshManager.isStopped()) {
// look for the section to be refreshed, and notify it:
if (args) {
var sectionToRefresh = args.section;
if (sectionToRefresh && this._mainSection) {
var section = this._mainSection.getSectionById(sectionToRefresh);
if (section) {
section.notifyRefreshPlanned(args);
return;
}
}
}
ariaTemplatesRefreshManager.queue({
fn : this.$refresh,
args : args,
scope : this
}, this);
} else {
if (!this._cfg.tplDiv) {
// this can happen if calling $refresh before linkToPreviousMarkup is called
// (for example: including a sub-template which is already in the cache, and calling refresh in
// the onModuleEvent of the sub-template with no condition in the template script)
this.$logError(this.TEMPLATE_NOT_READY_FOR_REFRESH, [this.tplClasspath]);
return;
}
if (this._refreshing) {
this.$logError(this.ALREADY_REFRESHING, [this.tplClasspath]);
// TODO: call return when backward compatibility is removed
}
this._refreshing = true;
// PROFILING // var profilingId = this.$startMeasure("Refreshing " + this.tplClasspath);
// stopping the refresh manager ensure that what we are doing now will not impact elements that will
// be disposed
ariaTemplatesRefreshManager.stop();
// stopping the CSS Manager as weel to avoid refreshing it every time we create a widget
ariaTemplatesCSSMgr.stop();
this.$assert(304, !!this._tpl); // CSS dependencies
var validatorParam = {
json : args,
beanName : "aria.templates.CfgBeans.RefreshCfg"
};
ariaCoreJsonValidator.normalize(validatorParam);
args = validatorParam.json;
// call the $beforeRefresh if defined in the script associated to the template
this.beforeRefresh(args);
var section = this.getRefreshedSection({
section : args.section,
macro : args.macro
});
// Before removing the content from the DOM dispose any processing indicators to avoid leaks
this.__disposeProcessingIndicators();
// Inserting a section will add the html in the page, resume the CSSMgr before
ariaTemplatesCSSMgr.resume();
if (section != null) {
this.insertSection(section, false, args);
}
this._refreshing = false;
// PROFILING // this.$stopMeasure(profilingId);
// restaure refresh manager
ariaTemplatesRefreshManager.resume();
// WARNING: this must always be the last thing to do
if (section != null) {
// call the $afterRefresh if defined in the script associated to the template
this.afterRefresh(args);
this.$raiseEvent({
name : "SectionRefreshed",
sectionID : section.id
});
}
}
} | [
"function",
"(",
"args",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_cfg",
")",
"{",
"return",
";",
"}",
"if",
"(",
"ariaTemplatesRefreshManager",
".",
"isStopped",
"(",
")",
")",
"{",
"if",
"(",
"args",
")",
"{",
"var",
"sectionToRefresh",
"=",
"args",
".",
"section",
";",
"if",
"(",
"sectionToRefresh",
"&&",
"this",
".",
"_mainSection",
")",
"{",
"var",
"section",
"=",
"this",
".",
"_mainSection",
".",
"getSectionById",
"(",
"sectionToRefresh",
")",
";",
"if",
"(",
"section",
")",
"{",
"section",
".",
"notifyRefreshPlanned",
"(",
"args",
")",
";",
"return",
";",
"}",
"}",
"}",
"ariaTemplatesRefreshManager",
".",
"queue",
"(",
"{",
"fn",
":",
"this",
".",
"$refresh",
",",
"args",
":",
"args",
",",
"scope",
":",
"this",
"}",
",",
"this",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"this",
".",
"_cfg",
".",
"tplDiv",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"TEMPLATE_NOT_READY_FOR_REFRESH",
",",
"[",
"this",
".",
"tplClasspath",
"]",
")",
";",
"return",
";",
"}",
"if",
"(",
"this",
".",
"_refreshing",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"ALREADY_REFRESHING",
",",
"[",
"this",
".",
"tplClasspath",
"]",
")",
";",
"}",
"this",
".",
"_refreshing",
"=",
"true",
";",
"ariaTemplatesRefreshManager",
".",
"stop",
"(",
")",
";",
"ariaTemplatesCSSMgr",
".",
"stop",
"(",
")",
";",
"this",
".",
"$assert",
"(",
"304",
",",
"!",
"!",
"this",
".",
"_tpl",
")",
";",
"var",
"validatorParam",
"=",
"{",
"json",
":",
"args",
",",
"beanName",
":",
"\"aria.templates.CfgBeans.RefreshCfg\"",
"}",
";",
"ariaCoreJsonValidator",
".",
"normalize",
"(",
"validatorParam",
")",
";",
"args",
"=",
"validatorParam",
".",
"json",
";",
"this",
".",
"beforeRefresh",
"(",
"args",
")",
";",
"var",
"section",
"=",
"this",
".",
"getRefreshedSection",
"(",
"{",
"section",
":",
"args",
".",
"section",
",",
"macro",
":",
"args",
".",
"macro",
"}",
")",
";",
"this",
".",
"__disposeProcessingIndicators",
"(",
")",
";",
"ariaTemplatesCSSMgr",
".",
"resume",
"(",
")",
";",
"if",
"(",
"section",
"!=",
"null",
")",
"{",
"this",
".",
"insertSection",
"(",
"section",
",",
"false",
",",
"args",
")",
";",
"}",
"this",
".",
"_refreshing",
"=",
"false",
";",
"ariaTemplatesRefreshManager",
".",
"resume",
"(",
")",
";",
"if",
"(",
"section",
"!=",
"null",
")",
"{",
"this",
".",
"afterRefresh",
"(",
"args",
")",
";",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"SectionRefreshed\"",
",",
"sectionID",
":",
"section",
".",
"id",
"}",
")",
";",
"}",
"}",
"}"
]
| Do a partial or whole refresh of the template, using the specified macro and section. This method can be
called from templates and template scripts.
@param {aria.templates.CfgBeans:RefreshCfg} args macro and section for the refresh. If not specified, do
a complete refresh.
@implements aria.templates.ITemplate | [
"Do",
"a",
"partial",
"or",
"whole",
"refresh",
"of",
"the",
"template",
"using",
"the",
"specified",
"macro",
"and",
"section",
".",
"This",
"method",
"can",
"be",
"called",
"from",
"templates",
"and",
"template",
"scripts",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L390-L480 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (element) {
if (element.tagName === "BODY" || !ariaUtilsDom.isInDom(element)) {
return [];
}
var Ids = [];
while (!element.__widget) {
element = element.parentElement || element.parentNode; // Fx < 9 compat
}
var id = element.__widget.getId();
if (!id) {
return [];
}
Ids.unshift(id);
var context = element.__widget._context;
while (this !== context && context !== null) {
id = context.getOriginalId();
if (!id) {
return [];
}
Ids.unshift(id);
context = context.parent;
}
if (context === null) {
return [];
}
return Ids;
} | javascript | function (element) {
if (element.tagName === "BODY" || !ariaUtilsDom.isInDom(element)) {
return [];
}
var Ids = [];
while (!element.__widget) {
element = element.parentElement || element.parentNode; // Fx < 9 compat
}
var id = element.__widget.getId();
if (!id) {
return [];
}
Ids.unshift(id);
var context = element.__widget._context;
while (this !== context && context !== null) {
id = context.getOriginalId();
if (!id) {
return [];
}
Ids.unshift(id);
context = context.parent;
}
if (context === null) {
return [];
}
return Ids;
} | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"tagName",
"===",
"\"BODY\"",
"||",
"!",
"ariaUtilsDom",
".",
"isInDom",
"(",
"element",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"var",
"Ids",
"=",
"[",
"]",
";",
"while",
"(",
"!",
"element",
".",
"__widget",
")",
"{",
"element",
"=",
"element",
".",
"parentElement",
"||",
"element",
".",
"parentNode",
";",
"}",
"var",
"id",
"=",
"element",
".",
"__widget",
".",
"getId",
"(",
")",
";",
"if",
"(",
"!",
"id",
")",
"{",
"return",
"[",
"]",
";",
"}",
"Ids",
".",
"unshift",
"(",
"id",
")",
";",
"var",
"context",
"=",
"element",
".",
"__widget",
".",
"_context",
";",
"while",
"(",
"this",
"!==",
"context",
"&&",
"context",
"!==",
"null",
")",
"{",
"id",
"=",
"context",
".",
"getOriginalId",
"(",
")",
";",
"if",
"(",
"!",
"id",
")",
"{",
"return",
"[",
"]",
";",
"}",
"Ids",
".",
"unshift",
"(",
"id",
")",
";",
"context",
"=",
"context",
".",
"parent",
";",
"}",
"if",
"(",
"context",
"===",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"Ids",
";",
"}"
]
| Tries to find the widget id based on an HTML element, if no id can be found then null is returned.
@param {HTMLElement} element which is a part of a widget that the id needs to be retrieved for.
@return {Array} contains ids for the widget and templates that make the focused widget path. | [
"Tries",
"to",
"find",
"the",
"widget",
"id",
"based",
"on",
"an",
"HTML",
"element",
"if",
"no",
"id",
"can",
"be",
"found",
"then",
"null",
"is",
"returned",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L504-L530 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (macro) {
/* must not be already linked */
this.$assert(299, this._cfg.tplDiv == null);
/* must not have already been called */
this.$assert(301, this._mainSection == null);
// run the section
var section = this.getRefreshedSection({
macro : macro
});
// returns corresponding markup
return section.html;
} | javascript | function (macro) {
/* must not be already linked */
this.$assert(299, this._cfg.tplDiv == null);
/* must not have already been called */
this.$assert(301, this._mainSection == null);
// run the section
var section = this.getRefreshedSection({
macro : macro
});
// returns corresponding markup
return section.html;
} | [
"function",
"(",
"macro",
")",
"{",
"this",
".",
"$assert",
"(",
"299",
",",
"this",
".",
"_cfg",
".",
"tplDiv",
"==",
"null",
")",
";",
"this",
".",
"$assert",
"(",
"301",
",",
"this",
".",
"_mainSection",
"==",
"null",
")",
";",
"var",
"section",
"=",
"this",
".",
"getRefreshedSection",
"(",
"{",
"macro",
":",
"macro",
"}",
")",
";",
"return",
"section",
".",
"html",
";",
"}"
]
| Build and return the HTML string containing the markup for the template. This method must only be called
once per template context instance, and only if the tplDiv property of the parameter of InitTemplate was
undefined. When this function returns a non-null argument, you must call linkToPreviousMarkup after
inserting the returned html in the DOM, so that widgets are properly initialized.
@param {aria.templates.CfgBeans:MacroCfg} macro macro to call to generate the markup
@return {String} html markup for the template | [
"Build",
"and",
"return",
"the",
"HTML",
"string",
"containing",
"the",
"markup",
"for",
"the",
"template",
".",
"This",
"method",
"must",
"only",
"be",
"called",
"once",
"per",
"template",
"context",
"instance",
"and",
"only",
"if",
"the",
"tplDiv",
"property",
"of",
"the",
"parameter",
"of",
"InitTemplate",
"was",
"undefined",
".",
"When",
"this",
"function",
"returns",
"a",
"non",
"-",
"null",
"argument",
"you",
"must",
"call",
"linkToPreviousMarkup",
"after",
"inserting",
"the",
"returned",
"html",
"in",
"the",
"DOM",
"so",
"that",
"widgets",
"are",
"properly",
"initialized",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L544-L556 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (tplDiv) {
var params = this._cfg;
/* check parameter: */
this.$assert(320, tplDiv != null);
/* must not be already linked: */
this.$assert(322, params.tplDiv == null);
/* must already have a markup waiting to be linked: */
this.$assert(324, this._mainSection != null);
params.tplDiv = tplDiv;
params.div = (tplDiv.parentNode) ? tplDiv.parentNode : null;
this.__addDebugInfo(tplDiv);
this.insertSection(this._mainSection, true);
// getMarkup + linkToPreviousMarkup is in fact doing the first refresh
// so we call $afterRefresh here as well
this.afterRefresh();
this.$raiseEvent({
name : "SectionRefreshed",
sectionID : null
});
} | javascript | function (tplDiv) {
var params = this._cfg;
/* check parameter: */
this.$assert(320, tplDiv != null);
/* must not be already linked: */
this.$assert(322, params.tplDiv == null);
/* must already have a markup waiting to be linked: */
this.$assert(324, this._mainSection != null);
params.tplDiv = tplDiv;
params.div = (tplDiv.parentNode) ? tplDiv.parentNode : null;
this.__addDebugInfo(tplDiv);
this.insertSection(this._mainSection, true);
// getMarkup + linkToPreviousMarkup is in fact doing the first refresh
// so we call $afterRefresh here as well
this.afterRefresh();
this.$raiseEvent({
name : "SectionRefreshed",
sectionID : null
});
} | [
"function",
"(",
"tplDiv",
")",
"{",
"var",
"params",
"=",
"this",
".",
"_cfg",
";",
"this",
".",
"$assert",
"(",
"320",
",",
"tplDiv",
"!=",
"null",
")",
";",
"this",
".",
"$assert",
"(",
"322",
",",
"params",
".",
"tplDiv",
"==",
"null",
")",
";",
"this",
".",
"$assert",
"(",
"324",
",",
"this",
".",
"_mainSection",
"!=",
"null",
")",
";",
"params",
".",
"tplDiv",
"=",
"tplDiv",
";",
"params",
".",
"div",
"=",
"(",
"tplDiv",
".",
"parentNode",
")",
"?",
"tplDiv",
".",
"parentNode",
":",
"null",
";",
"this",
".",
"__addDebugInfo",
"(",
"tplDiv",
")",
";",
"this",
".",
"insertSection",
"(",
"this",
".",
"_mainSection",
",",
"true",
")",
";",
"this",
".",
"afterRefresh",
"(",
")",
";",
"this",
".",
"$raiseEvent",
"(",
"{",
"name",
":",
"\"SectionRefreshed\"",
",",
"sectionID",
":",
"null",
"}",
")",
";",
"}"
]
| Initializes the widgets of the template after the HTML markup returned by getMarkup has been inserted in
the DOM.
@param {HTMLElement} tplDiv element in which the HTML markup has been inserted | [
"Initializes",
"the",
"widgets",
"of",
"the",
"template",
"after",
"the",
"HTML",
"markup",
"returned",
"by",
"getMarkup",
"has",
"been",
"inserted",
"in",
"the",
"DOM",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L563-L582 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (tplDiv) {
if (tplDiv && tplDiv.setAttribute) {
tplDiv.setAttribute("_template", this.tplClasspath);
tplDiv.__template = this._tpl;
tplDiv.__moduleCtrl = (this.moduleCtrlPrivate ? this.moduleCtrlPrivate : this.moduleCtrl);
tplDiv.__data = this.data;
}
} | javascript | function (tplDiv) {
if (tplDiv && tplDiv.setAttribute) {
tplDiv.setAttribute("_template", this.tplClasspath);
tplDiv.__template = this._tpl;
tplDiv.__moduleCtrl = (this.moduleCtrlPrivate ? this.moduleCtrlPrivate : this.moduleCtrl);
tplDiv.__data = this.data;
}
} | [
"function",
"(",
"tplDiv",
")",
"{",
"if",
"(",
"tplDiv",
"&&",
"tplDiv",
".",
"setAttribute",
")",
"{",
"tplDiv",
".",
"setAttribute",
"(",
"\"_template\"",
",",
"this",
".",
"tplClasspath",
")",
";",
"tplDiv",
".",
"__template",
"=",
"this",
".",
"_tpl",
";",
"tplDiv",
".",
"__moduleCtrl",
"=",
"(",
"this",
".",
"moduleCtrlPrivate",
"?",
"this",
".",
"moduleCtrlPrivate",
":",
"this",
".",
"moduleCtrl",
")",
";",
"tplDiv",
".",
"__data",
"=",
"this",
".",
"data",
";",
"}",
"}"
]
| Add debug information as expandos on the tplDiv element.
@param {aria.templates.CfgBeans:Div} tplDiv Reference to the div where to store debug information. Do
nothing if tplDiv is either null or does not have the setAttribute method. | [
"Add",
"debug",
"information",
"as",
"expandos",
"on",
"the",
"tplDiv",
"element",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L589-L596 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (tplDiv) {
if (tplDiv) {
tplDiv.__data = null;
tplDiv.__moduleCtrl = null;
tplDiv.__template = null;
}
} | javascript | function (tplDiv) {
if (tplDiv) {
tplDiv.__data = null;
tplDiv.__moduleCtrl = null;
tplDiv.__template = null;
}
} | [
"function",
"(",
"tplDiv",
")",
"{",
"if",
"(",
"tplDiv",
")",
"{",
"tplDiv",
".",
"__data",
"=",
"null",
";",
"tplDiv",
".",
"__moduleCtrl",
"=",
"null",
";",
"tplDiv",
".",
"__template",
"=",
"null",
";",
"}",
"}"
]
| Remove debug information from the DOM element. Do nothing if the parameter is null.
@param {HTMLElement} tplDiv | [
"Remove",
"debug",
"information",
"from",
"the",
"DOM",
"element",
".",
"Do",
"nothing",
"if",
"the",
"parameter",
"is",
"null",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L602-L608 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (args) {
// PROFILING // var profilingId = this.$startMeasure("Generate markup for " + this.tplClasspath);
var validatorParam = {
json : args,
beanName : "aria.templates.CfgBeans.GetRefreshedSectionCfg"
};
ariaCoreJsonValidator.normalize(validatorParam);
args = validatorParam.json;
var sectionId = args.section;
var sectionToReplace = null;
if (sectionId != null) {
sectionToReplace = (this._mainSection ? this._mainSection.getSectionById(sectionId) : null);
if (sectionToReplace == null) {
// PROFILING // this.$stopMeasure(profilingId);
this.$logError(this.SECTION_OUTPUT_NOT_FOUND, [this.tplClasspath, sectionId]);
return null;
}
sectionToReplace.beforeRefresh(args);
// desactivate section to refresh, not to trigger bindings when creating the new section
sectionToReplace.stopListeners();
}
var writerCallback = args.writerCallback;
if (writerCallback == null) {
writerCallback = {
fn : this._callMacro,
args : args.macro,
scope : this
};
}
var section = this.createSection(writerCallback, {
ownIdMap : (sectionToReplace == null)
});
if (section == null) {
// PROFILING // this.$stopMeasure(profilingId);
return null;
}
if (sectionToReplace == null) {
// replace the whole main section
if (this._mainSection) {
this._mainSection.$dispose();
}
this._mainSection = section;
} else {
sectionToReplace.removeContent();
sectionToReplace.removeDelegateIdsAndCallbacks();
sectionToReplace.disposeProcessingIndicator();
section.moveContentTo(sectionToReplace);
sectionToReplace.html = section.html;
section.$dispose();
section = sectionToReplace;
section.resumeListeners();
}
// PROFILING // this.$stopMeasure(profilingId);
return section;
} | javascript | function (args) {
// PROFILING // var profilingId = this.$startMeasure("Generate markup for " + this.tplClasspath);
var validatorParam = {
json : args,
beanName : "aria.templates.CfgBeans.GetRefreshedSectionCfg"
};
ariaCoreJsonValidator.normalize(validatorParam);
args = validatorParam.json;
var sectionId = args.section;
var sectionToReplace = null;
if (sectionId != null) {
sectionToReplace = (this._mainSection ? this._mainSection.getSectionById(sectionId) : null);
if (sectionToReplace == null) {
// PROFILING // this.$stopMeasure(profilingId);
this.$logError(this.SECTION_OUTPUT_NOT_FOUND, [this.tplClasspath, sectionId]);
return null;
}
sectionToReplace.beforeRefresh(args);
// desactivate section to refresh, not to trigger bindings when creating the new section
sectionToReplace.stopListeners();
}
var writerCallback = args.writerCallback;
if (writerCallback == null) {
writerCallback = {
fn : this._callMacro,
args : args.macro,
scope : this
};
}
var section = this.createSection(writerCallback, {
ownIdMap : (sectionToReplace == null)
});
if (section == null) {
// PROFILING // this.$stopMeasure(profilingId);
return null;
}
if (sectionToReplace == null) {
// replace the whole main section
if (this._mainSection) {
this._mainSection.$dispose();
}
this._mainSection = section;
} else {
sectionToReplace.removeContent();
sectionToReplace.removeDelegateIdsAndCallbacks();
sectionToReplace.disposeProcessingIndicator();
section.moveContentTo(sectionToReplace);
sectionToReplace.html = section.html;
section.$dispose();
section = sectionToReplace;
section.resumeListeners();
}
// PROFILING // this.$stopMeasure(profilingId);
return section;
} | [
"function",
"(",
"args",
")",
"{",
"var",
"validatorParam",
"=",
"{",
"json",
":",
"args",
",",
"beanName",
":",
"\"aria.templates.CfgBeans.GetRefreshedSectionCfg\"",
"}",
";",
"ariaCoreJsonValidator",
".",
"normalize",
"(",
"validatorParam",
")",
";",
"args",
"=",
"validatorParam",
".",
"json",
";",
"var",
"sectionId",
"=",
"args",
".",
"section",
";",
"var",
"sectionToReplace",
"=",
"null",
";",
"if",
"(",
"sectionId",
"!=",
"null",
")",
"{",
"sectionToReplace",
"=",
"(",
"this",
".",
"_mainSection",
"?",
"this",
".",
"_mainSection",
".",
"getSectionById",
"(",
"sectionId",
")",
":",
"null",
")",
";",
"if",
"(",
"sectionToReplace",
"==",
"null",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"SECTION_OUTPUT_NOT_FOUND",
",",
"[",
"this",
".",
"tplClasspath",
",",
"sectionId",
"]",
")",
";",
"return",
"null",
";",
"}",
"sectionToReplace",
".",
"beforeRefresh",
"(",
"args",
")",
";",
"sectionToReplace",
".",
"stopListeners",
"(",
")",
";",
"}",
"var",
"writerCallback",
"=",
"args",
".",
"writerCallback",
";",
"if",
"(",
"writerCallback",
"==",
"null",
")",
"{",
"writerCallback",
"=",
"{",
"fn",
":",
"this",
".",
"_callMacro",
",",
"args",
":",
"args",
".",
"macro",
",",
"scope",
":",
"this",
"}",
";",
"}",
"var",
"section",
"=",
"this",
".",
"createSection",
"(",
"writerCallback",
",",
"{",
"ownIdMap",
":",
"(",
"sectionToReplace",
"==",
"null",
")",
"}",
")",
";",
"if",
"(",
"section",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"sectionToReplace",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"_mainSection",
")",
"{",
"this",
".",
"_mainSection",
".",
"$dispose",
"(",
")",
";",
"}",
"this",
".",
"_mainSection",
"=",
"section",
";",
"}",
"else",
"{",
"sectionToReplace",
".",
"removeContent",
"(",
")",
";",
"sectionToReplace",
".",
"removeDelegateIdsAndCallbacks",
"(",
")",
";",
"sectionToReplace",
".",
"disposeProcessingIndicator",
"(",
")",
";",
"section",
".",
"moveContentTo",
"(",
"sectionToReplace",
")",
";",
"sectionToReplace",
".",
"html",
"=",
"section",
".",
"html",
";",
"section",
".",
"$dispose",
"(",
")",
";",
"section",
"=",
"sectionToReplace",
";",
"section",
".",
"resumeListeners",
"(",
")",
";",
"}",
"return",
"section",
";",
"}"
]
| Generate the markup for a specific section and return the section object.
@param {aria.templates.CfgBeans:GetRefreshedSectionCfg} args | [
"Generate",
"the",
"markup",
"for",
"a",
"specific",
"section",
"and",
"return",
"the",
"section",
"object",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L614-L672 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (out) {
this._out = out;
var macrolibs = this._macrolibs || [];
for (var i = 0, l = macrolibs.length; i < l; i++) {
macrolibs[i]._setOut(out);
}
} | javascript | function (out) {
this._out = out;
var macrolibs = this._macrolibs || [];
for (var i = 0, l = macrolibs.length; i < l; i++) {
macrolibs[i]._setOut(out);
}
} | [
"function",
"(",
"out",
")",
"{",
"this",
".",
"_out",
"=",
"out",
";",
"var",
"macrolibs",
"=",
"this",
".",
"_macrolibs",
"||",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"macrolibs",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"macrolibs",
"[",
"i",
"]",
".",
"_setOut",
"(",
"out",
")",
";",
"}",
"}"
]
| Set the out object on this context and all its macro libs.
@param {aria.templates.MarkupWriter} out markup writer | [
"Set",
"the",
"out",
"object",
"on",
"this",
"context",
"and",
"all",
"its",
"macro",
"libs",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L678-L684 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (out, args) {
var sections = args.sections;
for (var i = 0, l = sections.length; i < l; i++) {
this.__$insertSection(null, sections[i]);
}
} | javascript | function (out, args) {
var sections = args.sections;
for (var i = 0, l = sections.length; i < l; i++) {
this.__$insertSection(null, sections[i]);
}
} | [
"function",
"(",
"out",
",",
"args",
")",
"{",
"var",
"sections",
"=",
"args",
".",
"sections",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"sections",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"this",
".",
"__$insertSection",
"(",
"null",
",",
"sections",
"[",
"i",
"]",
")",
";",
"}",
"}"
]
| Write dynamic sections.
@param {aria.templates.MarkupWriter} out markup writer.
@param {aria.templates.CfgBeans:InsertAdjacentSectionsCfg} args Adjacent sections configuration.
@private | [
"Write",
"dynamic",
"sections",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L729-L734 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (callback, options) {
if (this._out != null) {
// calling refresh while the HTML is being generated is not permitted
this.$logError(this.INVALID_STATE_FOR_REFRESH, [this.tplClasspath]);
return null;
}
var out = new ariaTemplatesMarkupWriter(this, options);
var res = null;
this._setOut(out);
this.$callback(callback, out);
res = out.getSection();
out.$dispose();
this._setOut(null);
return res;
} | javascript | function (callback, options) {
if (this._out != null) {
// calling refresh while the HTML is being generated is not permitted
this.$logError(this.INVALID_STATE_FOR_REFRESH, [this.tplClasspath]);
return null;
}
var out = new ariaTemplatesMarkupWriter(this, options);
var res = null;
this._setOut(out);
this.$callback(callback, out);
res = out.getSection();
out.$dispose();
this._setOut(null);
return res;
} | [
"function",
"(",
"callback",
",",
"options",
")",
"{",
"if",
"(",
"this",
".",
"_out",
"!=",
"null",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"INVALID_STATE_FOR_REFRESH",
",",
"[",
"this",
".",
"tplClasspath",
"]",
")",
";",
"return",
"null",
";",
"}",
"var",
"out",
"=",
"new",
"ariaTemplatesMarkupWriter",
"(",
"this",
",",
"options",
")",
";",
"var",
"res",
"=",
"null",
";",
"this",
".",
"_setOut",
"(",
"out",
")",
";",
"this",
".",
"$callback",
"(",
"callback",
",",
"out",
")",
";",
"res",
"=",
"out",
".",
"getSection",
"(",
")",
";",
"out",
".",
"$dispose",
"(",
")",
";",
"this",
".",
"_setOut",
"(",
"null",
")",
";",
"return",
"res",
";",
"}"
]
| Create a section. The section is not inserted in the sections tree of the template.
@param {aria.core.CfgBeans:Callback} callback callback which creates the content of the section. The
parameter given to this callback is the markup writer out object.
@param {Object} options optional object containing options for the markup writer | [
"Create",
"a",
"section",
".",
"The",
"section",
"is",
"not",
"inserted",
"in",
"the",
"sections",
"tree",
"of",
"the",
"template",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L742-L756 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (section, skipInsertHTML, refreshArgs) {
// PROFILING // var profilingId = this.$startMeasure("Inserting section in DOM from " +
// PROFILING // this.tplClasspath);
var differed;
var params = this._cfg;
var tpl = this._tpl;
var domElt = section.id ? section.getDom() : params.tplDiv;
if (domElt) {
if (!skipInsertHTML) {
section.insertHTML(domElt, refreshArgs);
}
if (!section.id) {
// the whole template is being refreshed; let's apply the correct size
// to its DOM container
ariaTemplatesLayout.setDivSize(domElt, tpl.$width, tpl.$height, 'hidden');
}
// update expando of container
ariaUtilsDelegate.addExpando(domElt, section.delegateId);
differed = section.initWidgets();
this.__processDifferedItems(differed);
} else {
// TODO: LOG ERROR
}
if (!skipInsertHTML) {
// Redundant, but makes sure that insertSection doesn't dispose the template
this.$assert(743, params.tplDiv && tpl);
ariaUtilsDom.refreshDomElt(params.tplDiv);
}
// PROFILING // this.$stopMeasure(profilingId);
} | javascript | function (section, skipInsertHTML, refreshArgs) {
// PROFILING // var profilingId = this.$startMeasure("Inserting section in DOM from " +
// PROFILING // this.tplClasspath);
var differed;
var params = this._cfg;
var tpl = this._tpl;
var domElt = section.id ? section.getDom() : params.tplDiv;
if (domElt) {
if (!skipInsertHTML) {
section.insertHTML(domElt, refreshArgs);
}
if (!section.id) {
// the whole template is being refreshed; let's apply the correct size
// to its DOM container
ariaTemplatesLayout.setDivSize(domElt, tpl.$width, tpl.$height, 'hidden');
}
// update expando of container
ariaUtilsDelegate.addExpando(domElt, section.delegateId);
differed = section.initWidgets();
this.__processDifferedItems(differed);
} else {
// TODO: LOG ERROR
}
if (!skipInsertHTML) {
// Redundant, but makes sure that insertSection doesn't dispose the template
this.$assert(743, params.tplDiv && tpl);
ariaUtilsDom.refreshDomElt(params.tplDiv);
}
// PROFILING // this.$stopMeasure(profilingId);
} | [
"function",
"(",
"section",
",",
"skipInsertHTML",
",",
"refreshArgs",
")",
"{",
"var",
"differed",
";",
"var",
"params",
"=",
"this",
".",
"_cfg",
";",
"var",
"tpl",
"=",
"this",
".",
"_tpl",
";",
"var",
"domElt",
"=",
"section",
".",
"id",
"?",
"section",
".",
"getDom",
"(",
")",
":",
"params",
".",
"tplDiv",
";",
"if",
"(",
"domElt",
")",
"{",
"if",
"(",
"!",
"skipInsertHTML",
")",
"{",
"section",
".",
"insertHTML",
"(",
"domElt",
",",
"refreshArgs",
")",
";",
"}",
"if",
"(",
"!",
"section",
".",
"id",
")",
"{",
"ariaTemplatesLayout",
".",
"setDivSize",
"(",
"domElt",
",",
"tpl",
".",
"$width",
",",
"tpl",
".",
"$height",
",",
"'hidden'",
")",
";",
"}",
"ariaUtilsDelegate",
".",
"addExpando",
"(",
"domElt",
",",
"section",
".",
"delegateId",
")",
";",
"differed",
"=",
"section",
".",
"initWidgets",
"(",
")",
";",
"this",
".",
"__processDifferedItems",
"(",
"differed",
")",
";",
"}",
"else",
"{",
"}",
"if",
"(",
"!",
"skipInsertHTML",
")",
"{",
"this",
".",
"$assert",
"(",
"743",
",",
"params",
".",
"tplDiv",
"&&",
"tpl",
")",
";",
"ariaUtilsDom",
".",
"refreshDomElt",
"(",
"params",
".",
"tplDiv",
")",
";",
"}",
"}"
]
| Insert the section's markup in the DOM | [
"Insert",
"the",
"section",
"s",
"markup",
"in",
"the",
"DOM"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L761-L793 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (evt) {
if (evt) {
var src = evt.src, differed = this._differed;
if (differed) {
ariaUtilsArray.remove(differed, src);
}
}
if (!differed || !differed.length) {
this._differed = null;
this._ready = true;
this.displayReady();
this.$raiseEvent("Ready");
// this.$stopMeasure(null, this.tplClasspath);
}
} | javascript | function (evt) {
if (evt) {
var src = evt.src, differed = this._differed;
if (differed) {
ariaUtilsArray.remove(differed, src);
}
}
if (!differed || !differed.length) {
this._differed = null;
this._ready = true;
this.displayReady();
this.$raiseEvent("Ready");
// this.$stopMeasure(null, this.tplClasspath);
}
} | [
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
")",
"{",
"var",
"src",
"=",
"evt",
".",
"src",
",",
"differed",
"=",
"this",
".",
"_differed",
";",
"if",
"(",
"differed",
")",
"{",
"ariaUtilsArray",
".",
"remove",
"(",
"differed",
",",
"src",
")",
";",
"}",
"}",
"if",
"(",
"!",
"differed",
"||",
"!",
"differed",
".",
"length",
")",
"{",
"this",
".",
"_differed",
"=",
"null",
";",
"this",
".",
"_ready",
"=",
"true",
";",
"this",
".",
"displayReady",
"(",
")",
";",
"this",
".",
"$raiseEvent",
"(",
"\"Ready\"",
")",
";",
"}",
"}"
]
| Callback used differed element are ready. When all elements are ready, raise "Ready" event.
@private
@param {Object} evt | [
"Callback",
"used",
"differed",
"element",
"are",
"ready",
".",
"When",
"all",
"elements",
"are",
"ready",
"raise",
"Ready",
"event",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L823-L837 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (baseId) {
baseId = this._id + "_" + baseId.replace(/\+/g, "");
// Calculate and return the new id
var prefixIds = this._prefixIds;
var id = prefixIds[baseId] = (prefixIds[baseId] || 0) + 1;
return baseId + "_auto_" + id;
} | javascript | function (baseId) {
baseId = this._id + "_" + baseId.replace(/\+/g, "");
// Calculate and return the new id
var prefixIds = this._prefixIds;
var id = prefixIds[baseId] = (prefixIds[baseId] || 0) + 1;
return baseId + "_auto_" + id;
} | [
"function",
"(",
"baseId",
")",
"{",
"baseId",
"=",
"this",
".",
"_id",
"+",
"\"_\"",
"+",
"baseId",
".",
"replace",
"(",
"/",
"\\+",
"/",
"g",
",",
"\"\"",
")",
";",
"var",
"prefixIds",
"=",
"this",
".",
"_prefixIds",
";",
"var",
"id",
"=",
"prefixIds",
"[",
"baseId",
"]",
"=",
"(",
"prefixIds",
"[",
"baseId",
"]",
"||",
"0",
")",
"+",
"1",
";",
"return",
"baseId",
"+",
"\"_auto_\"",
"+",
"id",
";",
"}"
]
| Generate an automatic id computed from a base id, with an incremental counter
@param {String} baseId specified in the template
@return {String} The global id to be used in the dom | [
"Generate",
"an",
"automatic",
"id",
"computed",
"from",
"a",
"base",
"id",
"with",
"an",
"incremental",
"counter"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1263-L1270 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (id) {
var id = id + "";
if (id && id.indexOf("+") != -1) {
if (Aria.testMode) {
return this.$getAutoId(id);
}
return null;
}
return this.$getId(id);
} | javascript | function (id) {
var id = id + "";
if (id && id.indexOf("+") != -1) {
if (Aria.testMode) {
return this.$getAutoId(id);
}
return null;
}
return this.$getId(id);
} | [
"function",
"(",
"id",
")",
"{",
"var",
"id",
"=",
"id",
"+",
"\"\"",
";",
"if",
"(",
"id",
"&&",
"id",
".",
"indexOf",
"(",
"\"+\"",
")",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"Aria",
".",
"testMode",
")",
"{",
"return",
"this",
".",
"$getAutoId",
"(",
"id",
")",
";",
"}",
"return",
"null",
";",
"}",
"return",
"this",
".",
"$getId",
"(",
"id",
")",
";",
"}"
]
| Return the generated domId for specified id.
@param {String|Number} id specified in the template. If it contains "+", an automatic id will be
generated if in the test mode.
@return {String} | [
"Return",
"the",
"generated",
"domId",
"for",
"specified",
"id",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1295-L1304 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function () {
var res = this._persistentStorage;
if (res == null) {
if (this.data) {
res = this.data[Aria.FRAMEWORK_PREFIX + "persist::" + this.tplClasspath];
if (res == null) {
res = {};
this.data[Aria.FRAMEWORK_PREFIX + "persist::" + this.tplClasspath] = res;
}
} else {
res = {};
}
this._persistentStorage = res;
}
return res;
} | javascript | function () {
var res = this._persistentStorage;
if (res == null) {
if (this.data) {
res = this.data[Aria.FRAMEWORK_PREFIX + "persist::" + this.tplClasspath];
if (res == null) {
res = {};
this.data[Aria.FRAMEWORK_PREFIX + "persist::" + this.tplClasspath] = res;
}
} else {
res = {};
}
this._persistentStorage = res;
}
return res;
} | [
"function",
"(",
")",
"{",
"var",
"res",
"=",
"this",
".",
"_persistentStorage",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"data",
")",
"{",
"res",
"=",
"this",
".",
"data",
"[",
"Aria",
".",
"FRAMEWORK_PREFIX",
"+",
"\"persist::\"",
"+",
"this",
".",
"tplClasspath",
"]",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"res",
"=",
"{",
"}",
";",
"this",
".",
"data",
"[",
"Aria",
".",
"FRAMEWORK_PREFIX",
"+",
"\"persist::\"",
"+",
"this",
".",
"tplClasspath",
"]",
"=",
"res",
";",
"}",
"}",
"else",
"{",
"res",
"=",
"{",
"}",
";",
"}",
"this",
".",
"_persistentStorage",
"=",
"res",
";",
"}",
"return",
"res",
";",
"}"
]
| Get a persistent storage place. | [
"Get",
"a",
"persistent",
"storage",
"place",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1370-L1385 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (idArray) {
ariaUtilsDelegate.ieFocusFix();
var idToFocus;
if (ariaUtilsType.isArray(idArray)) {
idArray = idArray.slice(0);
idToFocus = idArray.shift();
} else {
idToFocus = idArray;
idArray = [];
}
if (!idToFocus) {
return;
}
var focusSuccess = false; // First look for widget...
var widgetToFocus = this.getBehaviorById(idToFocus);
if (widgetToFocus && (typeof(widgetToFocus.focus) != "undefined")) {
widgetToFocus.focus(idArray);
focusSuccess = true;
}
// ... then look for arbitrary dom element with id
if (!focusSuccess) {
var domElementId = this.$getId(idToFocus);
var elementToFocus = ariaUtilsDom.getElementById(domElementId);
if (elementToFocus) {
elementToFocus.focus();
focusSuccess = true;
}
}
if (!focusSuccess) {
this.$logError(this.FOCUS_FAILURE, [idToFocus, this.tplClasspath]);
}
} | javascript | function (idArray) {
ariaUtilsDelegate.ieFocusFix();
var idToFocus;
if (ariaUtilsType.isArray(idArray)) {
idArray = idArray.slice(0);
idToFocus = idArray.shift();
} else {
idToFocus = idArray;
idArray = [];
}
if (!idToFocus) {
return;
}
var focusSuccess = false; // First look for widget...
var widgetToFocus = this.getBehaviorById(idToFocus);
if (widgetToFocus && (typeof(widgetToFocus.focus) != "undefined")) {
widgetToFocus.focus(idArray);
focusSuccess = true;
}
// ... then look for arbitrary dom element with id
if (!focusSuccess) {
var domElementId = this.$getId(idToFocus);
var elementToFocus = ariaUtilsDom.getElementById(domElementId);
if (elementToFocus) {
elementToFocus.focus();
focusSuccess = true;
}
}
if (!focusSuccess) {
this.$logError(this.FOCUS_FAILURE, [idToFocus, this.tplClasspath]);
}
} | [
"function",
"(",
"idArray",
")",
"{",
"ariaUtilsDelegate",
".",
"ieFocusFix",
"(",
")",
";",
"var",
"idToFocus",
";",
"if",
"(",
"ariaUtilsType",
".",
"isArray",
"(",
"idArray",
")",
")",
"{",
"idArray",
"=",
"idArray",
".",
"slice",
"(",
"0",
")",
";",
"idToFocus",
"=",
"idArray",
".",
"shift",
"(",
")",
";",
"}",
"else",
"{",
"idToFocus",
"=",
"idArray",
";",
"idArray",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"idToFocus",
")",
"{",
"return",
";",
"}",
"var",
"focusSuccess",
"=",
"false",
";",
"var",
"widgetToFocus",
"=",
"this",
".",
"getBehaviorById",
"(",
"idToFocus",
")",
";",
"if",
"(",
"widgetToFocus",
"&&",
"(",
"typeof",
"(",
"widgetToFocus",
".",
"focus",
")",
"!=",
"\"undefined\"",
")",
")",
"{",
"widgetToFocus",
".",
"focus",
"(",
"idArray",
")",
";",
"focusSuccess",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"focusSuccess",
")",
"{",
"var",
"domElementId",
"=",
"this",
".",
"$getId",
"(",
"idToFocus",
")",
";",
"var",
"elementToFocus",
"=",
"ariaUtilsDom",
".",
"getElementById",
"(",
"domElementId",
")",
";",
"if",
"(",
"elementToFocus",
")",
"{",
"elementToFocus",
".",
"focus",
"(",
")",
";",
"focusSuccess",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"!",
"focusSuccess",
")",
"{",
"this",
".",
"$logError",
"(",
"this",
".",
"FOCUS_FAILURE",
",",
"[",
"idToFocus",
",",
"this",
".",
"tplClasspath",
"]",
")",
";",
"}",
"}"
]
| Focus a widget with a specified id programmatically. This method can be called from templates and
template scripts. If the focus fails, an error is thrown.
@param {String|Array} containing a path of ids of the widget to focus
@implements aria.templates.ITemplate | [
"Focus",
"a",
"widget",
"with",
"a",
"specified",
"id",
"programmatically",
".",
"This",
"method",
"can",
"be",
"called",
"from",
"templates",
"and",
"template",
"scripts",
".",
"If",
"the",
"focus",
"fails",
"an",
"error",
"is",
"thrown",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1393-L1424 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (evt) {
var reloading = evt.reloadingObject;
var tmpCfg = this._getReloadCfg();
var isUsingModuleData = reloading && (this.moduleCtrl.getData() == tmpCfg.data);
Aria.disposeTemplate(tmpCfg.div); // dispose the old template
if (reloading) {
var oSelf = this;
reloading.$on({
scope : {},
"objectLoaded" : function (evt) {
tmpCfg.moduleCtrl = evt.object;
if (isUsingModuleData) {
tmpCfg.data = evt.object.getData();
}
oSelf._callLoadTemplate(tmpCfg);
}
});
}
} | javascript | function (evt) {
var reloading = evt.reloadingObject;
var tmpCfg = this._getReloadCfg();
var isUsingModuleData = reloading && (this.moduleCtrl.getData() == tmpCfg.data);
Aria.disposeTemplate(tmpCfg.div); // dispose the old template
if (reloading) {
var oSelf = this;
reloading.$on({
scope : {},
"objectLoaded" : function (evt) {
tmpCfg.moduleCtrl = evt.object;
if (isUsingModuleData) {
tmpCfg.data = evt.object.getData();
}
oSelf._callLoadTemplate(tmpCfg);
}
});
}
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"reloading",
"=",
"evt",
".",
"reloadingObject",
";",
"var",
"tmpCfg",
"=",
"this",
".",
"_getReloadCfg",
"(",
")",
";",
"var",
"isUsingModuleData",
"=",
"reloading",
"&&",
"(",
"this",
".",
"moduleCtrl",
".",
"getData",
"(",
")",
"==",
"tmpCfg",
".",
"data",
")",
";",
"Aria",
".",
"disposeTemplate",
"(",
"tmpCfg",
".",
"div",
")",
";",
"if",
"(",
"reloading",
")",
"{",
"var",
"oSelf",
"=",
"this",
";",
"reloading",
".",
"$on",
"(",
"{",
"scope",
":",
"{",
"}",
",",
"\"objectLoaded\"",
":",
"function",
"(",
"evt",
")",
"{",
"tmpCfg",
".",
"moduleCtrl",
"=",
"evt",
".",
"object",
";",
"if",
"(",
"isUsingModuleData",
")",
"{",
"tmpCfg",
".",
"data",
"=",
"evt",
".",
"object",
".",
"getData",
"(",
")",
";",
"}",
"oSelf",
".",
"_callLoadTemplate",
"(",
"tmpCfg",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
]
| Called when the module controller is about to be disposed.
@param {Object} event Module controller event.
@protected | [
"Called",
"when",
"the",
"module",
"controller",
"is",
"about",
"to",
"be",
"disposed",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1488-L1506 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function () {
var container = this.getContainerDiv();
var origCP = this._cfg.origClasspath ? this._cfg.origClasspath : this._cfg.classpath;
var tmpCfg = {
classpath : origCP,
width : this._cfg.width,
height : this._cfg.height,
printOptions : this._cfg.printOptions,
div : container,
data : this._cfg.data,
moduleCtrl : this.moduleCtrlPrivate, // target real module, and not the interface
provideContext : true, // needed for the callback for the widget case, to restore mapping
args : this._cfg.args
};
// moduleCtrl needs to be saved: it might be in toDispose of the template -> empty toDispose
this._cfg.toDispose = [];
return tmpCfg;
} | javascript | function () {
var container = this.getContainerDiv();
var origCP = this._cfg.origClasspath ? this._cfg.origClasspath : this._cfg.classpath;
var tmpCfg = {
classpath : origCP,
width : this._cfg.width,
height : this._cfg.height,
printOptions : this._cfg.printOptions,
div : container,
data : this._cfg.data,
moduleCtrl : this.moduleCtrlPrivate, // target real module, and not the interface
provideContext : true, // needed for the callback for the widget case, to restore mapping
args : this._cfg.args
};
// moduleCtrl needs to be saved: it might be in toDispose of the template -> empty toDispose
this._cfg.toDispose = [];
return tmpCfg;
} | [
"function",
"(",
")",
"{",
"var",
"container",
"=",
"this",
".",
"getContainerDiv",
"(",
")",
";",
"var",
"origCP",
"=",
"this",
".",
"_cfg",
".",
"origClasspath",
"?",
"this",
".",
"_cfg",
".",
"origClasspath",
":",
"this",
".",
"_cfg",
".",
"classpath",
";",
"var",
"tmpCfg",
"=",
"{",
"classpath",
":",
"origCP",
",",
"width",
":",
"this",
".",
"_cfg",
".",
"width",
",",
"height",
":",
"this",
".",
"_cfg",
".",
"height",
",",
"printOptions",
":",
"this",
".",
"_cfg",
".",
"printOptions",
",",
"div",
":",
"container",
",",
"data",
":",
"this",
".",
"_cfg",
".",
"data",
",",
"moduleCtrl",
":",
"this",
".",
"moduleCtrlPrivate",
",",
"provideContext",
":",
"true",
",",
"args",
":",
"this",
".",
"_cfg",
".",
"args",
"}",
";",
"this",
".",
"_cfg",
".",
"toDispose",
"=",
"[",
"]",
";",
"return",
"tmpCfg",
";",
"}"
]
| Return the configuration object to use with Aria.loadTemplate to reload this template. With the result of
this method, it is possible to call this._callLoadTemplate.
@return {aria.templates.CfgBeans:LoadTemplateCfg}
@protected | [
"Return",
"the",
"configuration",
"object",
"to",
"use",
"with",
"Aria",
".",
"loadTemplate",
"to",
"reload",
"this",
"template",
".",
"With",
"the",
"result",
"of",
"this",
"method",
"it",
"is",
"possible",
"to",
"call",
"this",
".",
"_callLoadTemplate",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1514-L1532 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (tmpCfg, callback) {
var div = tmpCfg.div;
// check if the div is still in the dom
// (because it could be inside a template which was refreshed, so no longer in the dom)
if (!ariaUtilsDom.isInDom(div)) {
this.$callback(callback);
return;
}
var tplWidget = div.__widget;
Aria.loadTemplate(tmpCfg, function (args) {
// remap widget content
if (args.success && tplWidget) {
var tplCtxt = args.tplCtxt;
var tplCtxtManager = ariaTemplatesTemplateCtxtManager;
// TODO: find a cleaner way to do this
// as this template is inside a template widget, it is not a root template
// (even if we reloaded it with Aria.loadTemplate)
// This is necessary for the inspector not to display the template twice:
tplCtxtManager.remove(tplCtxt); // remove the template from the list of root templates
args.tplCtxt._cfg.isRootTemplate = false; // remove the root template flag
tplCtxtManager.add(tplCtxt); // add the template back to the list of templates
tplWidget.subTplCtxt = tplCtxt; // add the reference to the template context in the template
// widget
}
if (callback != null) {
this.$callback(callback);
}
});
} | javascript | function (tmpCfg, callback) {
var div = tmpCfg.div;
// check if the div is still in the dom
// (because it could be inside a template which was refreshed, so no longer in the dom)
if (!ariaUtilsDom.isInDom(div)) {
this.$callback(callback);
return;
}
var tplWidget = div.__widget;
Aria.loadTemplate(tmpCfg, function (args) {
// remap widget content
if (args.success && tplWidget) {
var tplCtxt = args.tplCtxt;
var tplCtxtManager = ariaTemplatesTemplateCtxtManager;
// TODO: find a cleaner way to do this
// as this template is inside a template widget, it is not a root template
// (even if we reloaded it with Aria.loadTemplate)
// This is necessary for the inspector not to display the template twice:
tplCtxtManager.remove(tplCtxt); // remove the template from the list of root templates
args.tplCtxt._cfg.isRootTemplate = false; // remove the root template flag
tplCtxtManager.add(tplCtxt); // add the template back to the list of templates
tplWidget.subTplCtxt = tplCtxt; // add the reference to the template context in the template
// widget
}
if (callback != null) {
this.$callback(callback);
}
});
} | [
"function",
"(",
"tmpCfg",
",",
"callback",
")",
"{",
"var",
"div",
"=",
"tmpCfg",
".",
"div",
";",
"if",
"(",
"!",
"ariaUtilsDom",
".",
"isInDom",
"(",
"div",
")",
")",
"{",
"this",
".",
"$callback",
"(",
"callback",
")",
";",
"return",
";",
"}",
"var",
"tplWidget",
"=",
"div",
".",
"__widget",
";",
"Aria",
".",
"loadTemplate",
"(",
"tmpCfg",
",",
"function",
"(",
"args",
")",
"{",
"if",
"(",
"args",
".",
"success",
"&&",
"tplWidget",
")",
"{",
"var",
"tplCtxt",
"=",
"args",
".",
"tplCtxt",
";",
"var",
"tplCtxtManager",
"=",
"ariaTemplatesTemplateCtxtManager",
";",
"tplCtxtManager",
".",
"remove",
"(",
"tplCtxt",
")",
";",
"args",
".",
"tplCtxt",
".",
"_cfg",
".",
"isRootTemplate",
"=",
"false",
";",
"tplCtxtManager",
".",
"add",
"(",
"tplCtxt",
")",
";",
"tplWidget",
".",
"subTplCtxt",
"=",
"tplCtxt",
";",
"}",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"this",
".",
"$callback",
"(",
"callback",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Call Aria.loadTemplate to reload this template.
@param {aria.templates.CfgBeans:LoadTemplateCfg} tmpCfg configuration for Aria.loadTemplate
@param {aria.core.CfgBeans:Callback} callback callback to be called when the reload is finished
@protected | [
"Call",
"Aria",
".",
"loadTemplate",
"to",
"reload",
"this",
"template",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1540-L1569 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (onlyCSSDep) {
var classes = this._cssClasses;
if (!classes) {
if (this._cfg.isRootTemplate) {
// PTR 05086835: load the global CSS here, and remember that it was loaded
var deps = ['aria.templates.GlobalStyle'];
if (aria.widgets && aria.widgets.AriaSkin) {
deps.push('aria.templates.LegacyGeneralStyle');
}
ariaTemplatesCSSMgr.loadWidgetDependencies('aria.templates.Template', deps);
this._globalCssDepsLoaded = true;
}
// Load the CSS dependencies, the style should be added before the html
classes = ariaTemplatesCSSMgr.loadDependencies(this);
this._cssClasses = classes; // save classes for later calls
}
if (onlyCSSDep) {
return classes.join(" ");
}
var classNames = ["xTplContent"];
// Add also the classes used by the CSS manager to scope a dependency
if (classes.length) {
classNames = classNames.concat(classes);
}
return ariaCoreTplClassLoader.addPrintOptions(classNames.join(" "), this._cfg.printOptions);
} | javascript | function (onlyCSSDep) {
var classes = this._cssClasses;
if (!classes) {
if (this._cfg.isRootTemplate) {
// PTR 05086835: load the global CSS here, and remember that it was loaded
var deps = ['aria.templates.GlobalStyle'];
if (aria.widgets && aria.widgets.AriaSkin) {
deps.push('aria.templates.LegacyGeneralStyle');
}
ariaTemplatesCSSMgr.loadWidgetDependencies('aria.templates.Template', deps);
this._globalCssDepsLoaded = true;
}
// Load the CSS dependencies, the style should be added before the html
classes = ariaTemplatesCSSMgr.loadDependencies(this);
this._cssClasses = classes; // save classes for later calls
}
if (onlyCSSDep) {
return classes.join(" ");
}
var classNames = ["xTplContent"];
// Add also the classes used by the CSS manager to scope a dependency
if (classes.length) {
classNames = classNames.concat(classes);
}
return ariaCoreTplClassLoader.addPrintOptions(classNames.join(" "), this._cfg.printOptions);
} | [
"function",
"(",
"onlyCSSDep",
")",
"{",
"var",
"classes",
"=",
"this",
".",
"_cssClasses",
";",
"if",
"(",
"!",
"classes",
")",
"{",
"if",
"(",
"this",
".",
"_cfg",
".",
"isRootTemplate",
")",
"{",
"var",
"deps",
"=",
"[",
"'aria.templates.GlobalStyle'",
"]",
";",
"if",
"(",
"aria",
".",
"widgets",
"&&",
"aria",
".",
"widgets",
".",
"AriaSkin",
")",
"{",
"deps",
".",
"push",
"(",
"'aria.templates.LegacyGeneralStyle'",
")",
";",
"}",
"ariaTemplatesCSSMgr",
".",
"loadWidgetDependencies",
"(",
"'aria.templates.Template'",
",",
"deps",
")",
";",
"this",
".",
"_globalCssDepsLoaded",
"=",
"true",
";",
"}",
"classes",
"=",
"ariaTemplatesCSSMgr",
".",
"loadDependencies",
"(",
"this",
")",
";",
"this",
".",
"_cssClasses",
"=",
"classes",
";",
"}",
"if",
"(",
"onlyCSSDep",
")",
"{",
"return",
"classes",
".",
"join",
"(",
"\" \"",
")",
";",
"}",
"var",
"classNames",
"=",
"[",
"\"xTplContent\"",
"]",
";",
"if",
"(",
"classes",
".",
"length",
")",
"{",
"classNames",
"=",
"classNames",
".",
"concat",
"(",
"classes",
")",
";",
"}",
"return",
"ariaCoreTplClassLoader",
".",
"addPrintOptions",
"(",
"classNames",
".",
"join",
"(",
"\" \"",
")",
",",
"this",
".",
"_cfg",
".",
"printOptions",
")",
";",
"}"
]
| Get the list of CSS classnames that should be added to the Template container DOM element
@param {Boolean} onlyCSSDep if true, only include CSS class names corresponding to CSS template
dependencies.
@return {String} | [
"Get",
"the",
"list",
"of",
"CSS",
"classnames",
"that",
"should",
"be",
"added",
"to",
"the",
"Template",
"container",
"DOM",
"element"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1626-L1651 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (status, id) {
this.$assert(1200, id != null);
if (status) {
this.__loadingOverlays.push(id);
} else {
ariaUtilsArray.remove(this.__loadingOverlays, id);
}
} | javascript | function (status, id) {
this.$assert(1200, id != null);
if (status) {
this.__loadingOverlays.push(id);
} else {
ariaUtilsArray.remove(this.__loadingOverlays, id);
}
} | [
"function",
"(",
"status",
",",
"id",
")",
"{",
"this",
".",
"$assert",
"(",
"1200",
",",
"id",
"!=",
"null",
")",
";",
"if",
"(",
"status",
")",
"{",
"this",
".",
"__loadingOverlays",
".",
"push",
"(",
"id",
")",
";",
"}",
"else",
"{",
"ariaUtilsArray",
".",
"remove",
"(",
"this",
".",
"__loadingOverlays",
",",
"id",
")",
";",
"}",
"}"
]
| Register a processing indicator, either around a DomElementWrapper or a SectionWrapper. This function
necessary to know which are the visible indicators during a refresh.
@param {Boolean} status if the indicator is visible or not
@param {String} id Unique indicator identifier | [
"Register",
"a",
"processing",
"indicator",
"either",
"around",
"a",
"DomElementWrapper",
"or",
"a",
"SectionWrapper",
".",
"This",
"function",
"necessary",
"to",
"know",
"which",
"are",
"the",
"visible",
"indicators",
"during",
"a",
"refresh",
"."
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1659-L1666 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function () {
var scrollPositions = null;
var containerDiv = this.getContainerDiv();
if (containerDiv) {
scrollPositions = {
scrollLeft : containerDiv.scrollLeft,
scrollTop : containerDiv.scrollTop
};
}
return scrollPositions;
} | javascript | function () {
var scrollPositions = null;
var containerDiv = this.getContainerDiv();
if (containerDiv) {
scrollPositions = {
scrollLeft : containerDiv.scrollLeft,
scrollTop : containerDiv.scrollTop
};
}
return scrollPositions;
} | [
"function",
"(",
")",
"{",
"var",
"scrollPositions",
"=",
"null",
";",
"var",
"containerDiv",
"=",
"this",
".",
"getContainerDiv",
"(",
")",
";",
"if",
"(",
"containerDiv",
")",
"{",
"scrollPositions",
"=",
"{",
"scrollLeft",
":",
"containerDiv",
".",
"scrollLeft",
",",
"scrollTop",
":",
"containerDiv",
".",
"scrollTop",
"}",
";",
"}",
"return",
"scrollPositions",
";",
"}"
]
| Return an object with the scrollTop and the scrollLeft values of the HTMLElement that contains the div of
the template
@return {Object} scrollTop and scrollLeft of the div that contains the template | [
"Return",
"an",
"object",
"with",
"the",
"scrollTop",
"and",
"the",
"scrollLeft",
"values",
"of",
"the",
"HTMLElement",
"that",
"contains",
"the",
"div",
"of",
"the",
"template"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1693-L1703 | train |
|
ariatemplates/ariatemplates | src/aria/templates/TemplateCtxt.js | function (scrollPositions) {
var containerDiv = this.getContainerDiv();
if (containerDiv && scrollPositions) {
if (scrollPositions.hasOwnProperty('scrollLeft') && scrollPositions.scrollLeft != null) {
containerDiv.scrollLeft = scrollPositions.scrollLeft;
}
if (scrollPositions.hasOwnProperty('scrollTop') && scrollPositions.scrollTop != null) {
containerDiv.scrollTop = scrollPositions.scrollTop;
}
}
} | javascript | function (scrollPositions) {
var containerDiv = this.getContainerDiv();
if (containerDiv && scrollPositions) {
if (scrollPositions.hasOwnProperty('scrollLeft') && scrollPositions.scrollLeft != null) {
containerDiv.scrollLeft = scrollPositions.scrollLeft;
}
if (scrollPositions.hasOwnProperty('scrollTop') && scrollPositions.scrollTop != null) {
containerDiv.scrollTop = scrollPositions.scrollTop;
}
}
} | [
"function",
"(",
"scrollPositions",
")",
"{",
"var",
"containerDiv",
"=",
"this",
".",
"getContainerDiv",
"(",
")",
";",
"if",
"(",
"containerDiv",
"&&",
"scrollPositions",
")",
"{",
"if",
"(",
"scrollPositions",
".",
"hasOwnProperty",
"(",
"'scrollLeft'",
")",
"&&",
"scrollPositions",
".",
"scrollLeft",
"!=",
"null",
")",
"{",
"containerDiv",
".",
"scrollLeft",
"=",
"scrollPositions",
".",
"scrollLeft",
";",
"}",
"if",
"(",
"scrollPositions",
".",
"hasOwnProperty",
"(",
"'scrollTop'",
")",
"&&",
"scrollPositions",
".",
"scrollTop",
"!=",
"null",
")",
"{",
"containerDiv",
".",
"scrollTop",
"=",
"scrollPositions",
".",
"scrollTop",
";",
"}",
"}",
"}"
]
| Set the scrollTop and the scrollLeft values of the HTMLElement that contains the div of the template
@param {Object} contains the desired scrollTop and scrollLeft values | [
"Set",
"the",
"scrollTop",
"and",
"the",
"scrollLeft",
"values",
"of",
"the",
"HTMLElement",
"that",
"contains",
"the",
"div",
"of",
"the",
"template"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TemplateCtxt.js#L1709-L1719 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/SelectBox.js | function () {
this.$DropDownTextInput._checkCfgConsistency.call(this);
var opt = this._cfg.options;
var values = [];
var dupValues = [];
var map = {};
for (var count = 0; count < opt.length; count++) {
if (map[opt[count].value]) {
dupValues.push(opt[count].value);
} else {
map[opt[count].value] = true;
values.push(opt[count]);
}
}
if (dupValues.length > 0) {
this.controller.setListOptions(values);
this.$logError(this.DUPLICATE_VALUE, [dupValues]);
}
} | javascript | function () {
this.$DropDownTextInput._checkCfgConsistency.call(this);
var opt = this._cfg.options;
var values = [];
var dupValues = [];
var map = {};
for (var count = 0; count < opt.length; count++) {
if (map[opt[count].value]) {
dupValues.push(opt[count].value);
} else {
map[opt[count].value] = true;
values.push(opt[count]);
}
}
if (dupValues.length > 0) {
this.controller.setListOptions(values);
this.$logError(this.DUPLICATE_VALUE, [dupValues]);
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"$DropDownTextInput",
".",
"_checkCfgConsistency",
".",
"call",
"(",
"this",
")",
";",
"var",
"opt",
"=",
"this",
".",
"_cfg",
".",
"options",
";",
"var",
"values",
"=",
"[",
"]",
";",
"var",
"dupValues",
"=",
"[",
"]",
";",
"var",
"map",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"count",
"=",
"0",
";",
"count",
"<",
"opt",
".",
"length",
";",
"count",
"++",
")",
"{",
"if",
"(",
"map",
"[",
"opt",
"[",
"count",
"]",
".",
"value",
"]",
")",
"{",
"dupValues",
".",
"push",
"(",
"opt",
"[",
"count",
"]",
".",
"value",
")",
";",
"}",
"else",
"{",
"map",
"[",
"opt",
"[",
"count",
"]",
".",
"value",
"]",
"=",
"true",
";",
"values",
".",
"push",
"(",
"opt",
"[",
"count",
"]",
")",
";",
"}",
"}",
"if",
"(",
"dupValues",
".",
"length",
">",
"0",
")",
"{",
"this",
".",
"controller",
".",
"setListOptions",
"(",
"values",
")",
";",
"this",
".",
"$logError",
"(",
"this",
".",
"DUPLICATE_VALUE",
",",
"[",
"dupValues",
"]",
")",
";",
"}",
"}"
]
| This method checks the consistancy of the values provided in the attributes of SelectBox and logs and error
if there are any descripancies | [
"This",
"method",
"checks",
"the",
"consistancy",
"of",
"the",
"values",
"provided",
"in",
"the",
"attributes",
"of",
"SelectBox",
"and",
"logs",
"and",
"error",
"if",
"there",
"are",
"any",
"descripancies"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/SelectBox.js#L88-L108 | train |
|
ariatemplates/ariatemplates | src/aria/widgets/form/SelectBox.js | function (propertyName, newValue, oldValue) {
if (propertyName === "options") {
this.controller.setListOptions(newValue);
var report = this.controller.checkValue(null);
this._reactToControllerReport(report, {
stopValueProp : true
});
} else {
aria.widgets.form.SelectBox.superclass._onBoundPropertyChange.call(this, propertyName, newValue, oldValue);
}
} | javascript | function (propertyName, newValue, oldValue) {
if (propertyName === "options") {
this.controller.setListOptions(newValue);
var report = this.controller.checkValue(null);
this._reactToControllerReport(report, {
stopValueProp : true
});
} else {
aria.widgets.form.SelectBox.superclass._onBoundPropertyChange.call(this, propertyName, newValue, oldValue);
}
} | [
"function",
"(",
"propertyName",
",",
"newValue",
",",
"oldValue",
")",
"{",
"if",
"(",
"propertyName",
"===",
"\"options\"",
")",
"{",
"this",
".",
"controller",
".",
"setListOptions",
"(",
"newValue",
")",
";",
"var",
"report",
"=",
"this",
".",
"controller",
".",
"checkValue",
"(",
"null",
")",
";",
"this",
".",
"_reactToControllerReport",
"(",
"report",
",",
"{",
"stopValueProp",
":",
"true",
"}",
")",
";",
"}",
"else",
"{",
"aria",
".",
"widgets",
".",
"form",
".",
"SelectBox",
".",
"superclass",
".",
"_onBoundPropertyChange",
".",
"call",
"(",
"this",
",",
"propertyName",
",",
"newValue",
",",
"oldValue",
")",
";",
"}",
"}"
]
| Internal method called when one of the model property that the widget is bound to has changed Must be
@param {String} propertyName the property name
@param {Object} newValue the new value
@param {Object} oldValue the old property value
@protected | [
"Internal",
"method",
"called",
"when",
"one",
"of",
"the",
"model",
"property",
"that",
"the",
"widget",
"is",
"bound",
"to",
"has",
"changed",
"Must",
"be"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/SelectBox.js#L117-L128 | train |
|
ariatemplates/ariatemplates | src/aria/html/Select.js | function () {
var bindings = this._cfg.bind;
var isBound = false;
// it doesn't make sense to bind both index and value,
// so we just state that the index takes precedence on the value
if (bindings.selectedIndex) {
var index = this._transform(bindings.selectedIndex.transform, bindings.selectedIndex.inside[bindings.selectedIndex.to], "toWidget");
if (index != null) {
if (!this.isIndexValid(index)) {
index = -1;
}
return index;
}
isBound = true;
}
if (bindings.value) {
var newValue = this._transform(bindings.value.transform, bindings.value.inside[bindings.value.to], "toWidget");
if (newValue != null) {
return this.getIndex(newValue);
}
isBound = true;
}
if (!isBound) {
this.$logWarn(this.BINDING_NEEDED, [this.$class, "selectedIndex"]);
}
} | javascript | function () {
var bindings = this._cfg.bind;
var isBound = false;
// it doesn't make sense to bind both index and value,
// so we just state that the index takes precedence on the value
if (bindings.selectedIndex) {
var index = this._transform(bindings.selectedIndex.transform, bindings.selectedIndex.inside[bindings.selectedIndex.to], "toWidget");
if (index != null) {
if (!this.isIndexValid(index)) {
index = -1;
}
return index;
}
isBound = true;
}
if (bindings.value) {
var newValue = this._transform(bindings.value.transform, bindings.value.inside[bindings.value.to], "toWidget");
if (newValue != null) {
return this.getIndex(newValue);
}
isBound = true;
}
if (!isBound) {
this.$logWarn(this.BINDING_NEEDED, [this.$class, "selectedIndex"]);
}
} | [
"function",
"(",
")",
"{",
"var",
"bindings",
"=",
"this",
".",
"_cfg",
".",
"bind",
";",
"var",
"isBound",
"=",
"false",
";",
"if",
"(",
"bindings",
".",
"selectedIndex",
")",
"{",
"var",
"index",
"=",
"this",
".",
"_transform",
"(",
"bindings",
".",
"selectedIndex",
".",
"transform",
",",
"bindings",
".",
"selectedIndex",
".",
"inside",
"[",
"bindings",
".",
"selectedIndex",
".",
"to",
"]",
",",
"\"toWidget\"",
")",
";",
"if",
"(",
"index",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isIndexValid",
"(",
"index",
")",
")",
"{",
"index",
"=",
"-",
"1",
";",
"}",
"return",
"index",
";",
"}",
"isBound",
"=",
"true",
";",
"}",
"if",
"(",
"bindings",
".",
"value",
")",
"{",
"var",
"newValue",
"=",
"this",
".",
"_transform",
"(",
"bindings",
".",
"value",
".",
"transform",
",",
"bindings",
".",
"value",
".",
"inside",
"[",
"bindings",
".",
"value",
".",
"to",
"]",
",",
"\"toWidget\"",
")",
";",
"if",
"(",
"newValue",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"getIndex",
"(",
"newValue",
")",
";",
"}",
"isBound",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"isBound",
")",
"{",
"this",
".",
"$logWarn",
"(",
"this",
".",
"BINDING_NEEDED",
",",
"[",
"this",
".",
"$class",
",",
"\"selectedIndex\"",
"]",
")",
";",
"}",
"}"
]
| Return the selected index from the value bound to the data model. if both selectedIndex and value are bound,
compute the index from selectedIndex. Throws a warning if there is no binding defined in the widget | [
"Return",
"the",
"selected",
"index",
"from",
"the",
"value",
"bound",
"to",
"the",
"data",
"model",
".",
"if",
"both",
"selectedIndex",
"and",
"value",
"are",
"bound",
"compute",
"the",
"index",
"from",
"selectedIndex",
".",
"Throws",
"a",
"warning",
"if",
"there",
"is",
"no",
"binding",
"defined",
"in",
"the",
"widget"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Select.js#L182-L209 | train |
|
ariatemplates/ariatemplates | src/aria/html/Select.js | function () {
if (!this.options) {
this.options = [];
if (this._domElt.options) {
for (var i = 0, l = this._domElt.options.length; i < l; i++) {
var elementToPush = {
value : this._domElt.options[i].value,
label : this._domElt.options[i].label
};
this.options.push(elementToPush);
}
}
}
} | javascript | function () {
if (!this.options) {
this.options = [];
if (this._domElt.options) {
for (var i = 0, l = this._domElt.options.length; i < l; i++) {
var elementToPush = {
value : this._domElt.options[i].value,
label : this._domElt.options[i].label
};
this.options.push(elementToPush);
}
}
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"options",
")",
"{",
"this",
".",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"this",
".",
"_domElt",
".",
"options",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"this",
".",
"_domElt",
".",
"options",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"var",
"elementToPush",
"=",
"{",
"value",
":",
"this",
".",
"_domElt",
".",
"options",
"[",
"i",
"]",
".",
"value",
",",
"label",
":",
"this",
".",
"_domElt",
".",
"options",
"[",
"i",
"]",
".",
"label",
"}",
";",
"this",
".",
"options",
".",
"push",
"(",
"elementToPush",
")",
";",
"}",
"}",
"}",
"}"
]
| get the options from the dom if they haven't been set from the cfg | [
"get",
"the",
"options",
"from",
"the",
"dom",
"if",
"they",
"haven",
"t",
"been",
"set",
"from",
"the",
"cfg"
]
| 7ed5d065818ae159bf361c9dfb209b1cf3883c90 | https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/Select.js#L214-L227 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.