_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q57000
|
train
|
function (evt) {
if (evt && evt._ariaDomEvent) {
evt._wrapperNumber++;
return evt;
} else {
return new aria.DomEvent(evt);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57001
|
train
|
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
|
{
"resource": ""
}
|
|
q57002
|
train
|
function (type, target) {
var evt = new aria.DomEvent({
type : type
});
evt.type = type;
evt.target = target;
return evt;
}
|
javascript
|
{
"resource": ""
}
|
|
q57003
|
train
|
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
|
{
"resource": ""
}
|
|
q57004
|
train
|
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
|
{
"resource": ""
}
|
|
q57005
|
train
|
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
|
{
"resource": ""
}
|
|
q57006
|
train
|
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
|
{
"resource": ""
}
|
|
q57007
|
train
|
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
|
{
"resource": ""
}
|
|
q57008
|
train
|
function () {
var dropDownIcon = this._dropDownIcon;
if (!dropDownIcon && this._frame && this._frame.getIcon) {
dropDownIcon = this._dropDownIcon = this._frame.getIcon("dropdown");
}
return dropDownIcon;
}
|
javascript
|
{
"resource": ""
}
|
|
q57009
|
train
|
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
|
{
"resource": ""
}
|
|
q57010
|
train
|
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
|
{
"resource": ""
}
|
|
q57011
|
train
|
function (event) {
var domEvent = aria.DomEvent;
if (event.keyCode === domEvent.KC_ENTER) {
this._updateValue(false);
}
this.$DropDownInput._dom_onkeypress.call(this, event);
}
|
javascript
|
{
"resource": ""
}
|
|
q57012
|
train
|
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
|
{
"resource": ""
}
|
|
q57013
|
train
|
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
|
{
"resource": ""
}
|
|
q57014
|
train
|
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
|
{
"resource": ""
}
|
|
q57015
|
train
|
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
|
{
"resource": ""
}
|
|
q57016
|
train
|
function (title) {
var document = window.document;
if (ariaUtilsType.isString(title)) {
document.title = title;
} else {
title = document.title;
}
return title;
}
|
javascript
|
{
"resource": ""
}
|
|
q57017
|
train
|
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
|
{
"resource": ""
}
|
|
q57018
|
train
|
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
|
{
"resource": ""
}
|
|
q57019
|
train
|
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
|
{
"resource": ""
}
|
|
q57020
|
train
|
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
|
{
"resource": ""
}
|
|
q57021
|
train
|
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
|
{
"resource": ""
}
|
|
q57022
|
train
|
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
|
{
"resource": ""
}
|
|
q57023
|
train
|
function (out) {
var oSelf = this;
ariaUtilsArray.forEach(this._iconsLeft, function (value) {
oSelf._writeIcon(value, out);
});
this._frame.writeMarkupBegin(out);
}
|
javascript
|
{
"resource": ""
}
|
|
q57024
|
train
|
function (iconName) {
this._icons[iconName].domElts = null;
ariaUtilsDelegate.remove(this._icons[iconName].iconDelegateId);
this._icons[iconName] = null;
delete this._icons[iconName];
}
|
javascript
|
{
"resource": ""
}
|
|
q57025
|
train
|
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
|
{
"resource": ""
}
|
|
q57026
|
train
|
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
|
{
"resource": ""
}
|
|
q57027
|
train
|
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
|
{
"resource": ""
}
|
|
q57028
|
train
|
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
|
{
"resource": ""
}
|
|
q57029
|
train
|
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
|
{
"resource": ""
}
|
|
q57030
|
train
|
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
|
{
"resource": ""
}
|
|
q57031
|
train
|
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
|
{
"resource": ""
}
|
|
q57032
|
train
|
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
|
{
"resource": ""
}
|
|
q57033
|
train
|
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
|
{
"resource": ""
}
|
|
q57034
|
train
|
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
|
{
"resource": ""
}
|
|
q57035
|
train
|
function () {
var cfg = this._cfg;
return ariaCoreBrowser.isIE11 && cfg.waiAria && cfg.disabled && this._isChecked() && cfg._inputType === "checkbox";
}
|
javascript
|
{
"resource": ""
}
|
|
q57036
|
train
|
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
|
{
"resource": ""
}
|
|
q57037
|
train
|
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
|
{
"resource": ""
}
|
|
q57038
|
train
|
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
|
{
"resource": ""
}
|
|
q57039
|
train
|
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
|
{
"resource": ""
}
|
|
q57040
|
train
|
function (tree, optionsOrAllDeps, callback, context, debug, skipLogError) {
var options = normalizeOptions(optionsOrAllDeps, context, debug, skipLogError);
this.__buildClass(tree, options, callback);
}
|
javascript
|
{
"resource": ""
}
|
|
q57041
|
train
|
function (statements) {
for (var i = 0, len = statements.length; i < len; i += 1) {
var statement = statements[i];
this.STATEMENTS[statement] = this.ALLSTATEMENTS[statement];
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57042
|
train
|
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
|
{
"resource": ""
}
|
|
q57043
|
train
|
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
|
{
"resource": ""
}
|
|
q57044
|
train
|
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
|
{
"resource": ""
}
|
|
q57045
|
train
|
function (statement, msgId, msgArgs, errorContext) {
if (msgArgs == null) {
msgArgs = [];
}
msgArgs.push(statement.lineNumber);
this.$logError(msgId, msgArgs, errorContext);
}
|
javascript
|
{
"resource": ""
}
|
|
q57046
|
train
|
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
|
{
"resource": ""
}
|
|
q57047
|
train
|
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
|
{
"resource": ""
}
|
|
q57048
|
train
|
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
|
{
"resource": ""
}
|
|
q57049
|
train
|
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
|
{
"resource": ""
}
|
|
q57050
|
train
|
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
|
{
"resource": ""
}
|
|
q57051
|
train
|
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
|
{
"resource": ""
}
|
|
q57052
|
train
|
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
|
{
"resource": ""
}
|
|
q57053
|
train
|
function (out) {
out.writeln("$prototype: {");
out.increaseIndent();
out.write(out.getBlockContent("prototype"));
out.decreaseIndent();
out.writeln("}");
out.decreaseIndent();
out.writeln("});");
out.leaveBlock();
}
|
javascript
|
{
"resource": ""
}
|
|
q57054
|
train
|
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
|
{
"resource": ""
}
|
|
q57055
|
train
|
function (elt1, elt2) {
if (elt1.sortKey == elt2.sortKey) {
return 0;
}
return (elt1.sortKey > elt2.sortKey ? 1 : -1);
}
|
javascript
|
{
"resource": ""
}
|
|
q57056
|
train
|
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
|
{
"resource": ""
}
|
|
q57057
|
train
|
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
|
{
"resource": ""
}
|
|
q57058
|
train
|
function (items) {
var itemsLength = items.length;
for (var i = 0; i < itemsLength; i++) {
json.removeListener(items[i], "filteredIn", this._jsonChangeCallback);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57059
|
train
|
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
|
{
"resource": ""
}
|
|
q57060
|
train
|
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
|
{
"resource": ""
}
|
|
q57061
|
train
|
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
|
{
"resource": ""
}
|
|
q57062
|
train
|
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
|
{
"resource": ""
}
|
|
q57063
|
train
|
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
|
{
"resource": ""
}
|
|
q57064
|
train
|
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
|
{
"resource": ""
}
|
|
q57065
|
train
|
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
|
{
"resource": ""
}
|
|
q57066
|
train
|
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
|
{
"resource": ""
}
|
|
q57067
|
train
|
function (array) {
if (!(ariaUtilsType.isObject(array) || ariaUtilsType.isArray(array))) {
this.$logError(this.INVALID_TYPE_OF_ARGUMENT);
return;
}
this.initialArray = array;
this._refreshInitialArray();
}
|
javascript
|
{
"resource": ""
}
|
|
q57068
|
train
|
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
|
{
"resource": ""
}
|
|
q57069
|
train
|
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
|
{
"resource": ""
}
|
|
q57070
|
train
|
function (src) {
var res = {};
for (var k in src) {
if (src.hasOwnProperty(k)) {
res[k] = src[k];
}
}
return res;
}
|
javascript
|
{
"resource": ""
}
|
|
q57071
|
sliceArguments
|
train
|
function sliceArguments(args, startIndex) {
if (startIndex == null) {
startIndex = 0;
}
return Array.prototype.slice.call(args, startIndex);
}
|
javascript
|
{
"resource": ""
}
|
q57072
|
createHiddenElement
|
train
|
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
|
{
"resource": ""
}
|
q57073
|
train
|
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
|
{
"resource": ""
}
|
|
q57074
|
train
|
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
|
{
"resource": ""
}
|
|
q57075
|
train
|
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
|
{
"resource": ""
}
|
|
q57076
|
train
|
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
|
{
"resource": ""
}
|
|
q57077
|
train
|
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
|
{
"resource": ""
}
|
|
q57078
|
train
|
function (tplDiv) {
if (tplDiv) {
tplDiv.__data = null;
tplDiv.__moduleCtrl = null;
tplDiv.__template = null;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57079
|
train
|
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
|
{
"resource": ""
}
|
|
q57080
|
train
|
function (out) {
this._out = out;
var macrolibs = this._macrolibs || [];
for (var i = 0, l = macrolibs.length; i < l; i++) {
macrolibs[i]._setOut(out);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57081
|
train
|
function (out, args) {
var sections = args.sections;
for (var i = 0, l = sections.length; i < l; i++) {
this.__$insertSection(null, sections[i]);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57082
|
train
|
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
|
{
"resource": ""
}
|
|
q57083
|
train
|
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
|
{
"resource": ""
}
|
|
q57084
|
train
|
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
|
{
"resource": ""
}
|
|
q57085
|
train
|
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
|
{
"resource": ""
}
|
|
q57086
|
train
|
function (id) {
var id = id + "";
if (id && id.indexOf("+") != -1) {
if (Aria.testMode) {
return this.$getAutoId(id);
}
return null;
}
return this.$getId(id);
}
|
javascript
|
{
"resource": ""
}
|
|
q57087
|
train
|
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
|
{
"resource": ""
}
|
|
q57088
|
train
|
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
|
{
"resource": ""
}
|
|
q57089
|
train
|
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
|
{
"resource": ""
}
|
|
q57090
|
train
|
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
|
{
"resource": ""
}
|
|
q57091
|
train
|
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
|
{
"resource": ""
}
|
|
q57092
|
train
|
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
|
{
"resource": ""
}
|
|
q57093
|
train
|
function (status, id) {
this.$assert(1200, id != null);
if (status) {
this.__loadingOverlays.push(id);
} else {
ariaUtilsArray.remove(this.__loadingOverlays, id);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q57094
|
train
|
function () {
var scrollPositions = null;
var containerDiv = this.getContainerDiv();
if (containerDiv) {
scrollPositions = {
scrollLeft : containerDiv.scrollLeft,
scrollTop : containerDiv.scrollTop
};
}
return scrollPositions;
}
|
javascript
|
{
"resource": ""
}
|
|
q57095
|
train
|
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
|
{
"resource": ""
}
|
|
q57096
|
train
|
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
|
{
"resource": ""
}
|
|
q57097
|
train
|
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
|
{
"resource": ""
}
|
|
q57098
|
train
|
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
|
{
"resource": ""
}
|
|
q57099
|
train
|
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
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.