_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q56700
train
function (eventOrCharCode, keyCode) { // -------------------------------------- input arguments processing var event; var charCode; if (ariaUtilsType.isObject(eventOrCharCode)) { event = eventOrCharCode; charCode = event.charCode; keyCode = event.keyCode; } else { event = null; charCode = eventOrCharCode; } // ------------------------------------------------------ processing var moduleCtrl = this._subTplModuleCtrl; var closeItem = this._getFirstEnabledItem(); if (moduleCtrl) { var data = moduleCtrl.getData(); if (!this.evalCallback(this._cfg.onkeyevent, { charCode : charCode, keyCode : keyCode, focusIndex : data.focusIndex, closeItem : closeItem, event : event })) { return moduleCtrl.keyevent({ charCode : charCode, keyCode : keyCode }); } else { return true; } } return false; }
javascript
{ "resource": "" }
q56701
train
function (event) { if (this._subTplModuleCtrl) { if (!event.isSpecialKey && event.charCode != event.KC_SPACE) { this.sendKey(event); } } }
javascript
{ "resource": "" }
q56702
train
function (event) { // event.cancelBubble = true; if (this._subTplModuleCtrl) { if (event.isSpecialKey) { this.sendKey(event); } } if (event.keyCode != event.KC_TAB) { event.preventDefault(); // Removing due to PTR:05164409 } return false; }
javascript
{ "resource": "" }
q56703
train
function () { var data = this._subTplModuleCtrl.getData(); var toFocus = data.itemsView.items[data.focusIndex].initIndex; if (data.items[toFocus].currentlyDisabled) { data.focusIndex = this._getFirstEnabledItem().id; } this._subTplModuleCtrl.setFocus(); }
javascript
{ "resource": "" }
q56704
train
function (key, newValue, oldValue) { // If the template needs a refresh, refreshNeeded has to be set to true // by each of the updates below that needs a refresh var refreshNeeded = false; var moduleCtrl = this._subTplModuleCtrl; // var data = this._subTplCtxt.data; if (key == "selectedValues") { moduleCtrl.setSelectedValues(newValue); } else if (key == "selectedIndex") { moduleCtrl.setSelectedIndex(newValue); } else if (key == "disabled") { moduleCtrl.setDisabled(newValue); refreshNeeded = true; } else if (key == "maxOptions") { moduleCtrl.setMaxSelectedCount(newValue); } else if (key == "items") { moduleCtrl.setItems(newValue); refreshNeeded = true; this._retrieveControllerSelection(); } else if (key == "multipleSelect") { moduleCtrl.setMultipleSelect(newValue); } if (refreshNeeded) { // TODO: this should be replaced by an event sent from the module controller // (but this would not be backward-compatible with current list templates) this._subTplCtxt.$refresh(); } }
javascript
{ "resource": "" }
q56705
train
function (property) { var bindings = this._cfg.bind, bind = bindings[property]; if (bindings && bind && bindings.hasOwnProperty(property) && property === "items") { var callback = { fn : this._notifyDataChange, scope : this, args : property }; try { ariaUtilsJson.addListener(bind.inside, bind.to, callback, true, true); this._bindingListeners[property] = { inside : bind.inside, to : bind.to, transform : bind.transform, cb : callback }; var newValue = this._transform(bind.transform, bind.inside[bind.to], "toWidget"); this._cfg[property] = newValue; } catch (ex) { this.$logError(this.INVALID_BEAN, [property, "bind"]); } } else { this.$TemplateBasedWidget._registerSingleProperty.apply(this, arguments); } }
javascript
{ "resource": "" }
q56706
train
function (propertyName, newValue) { if (!this._cfg) { return; } if (propertyName === "items" && this._cfg.bind.hasOwnProperty(propertyName)) { var oldValue = this.getProperty(propertyName); this._cfg[propertyName] = newValue; this._onBoundPropertyChange(propertyName, newValue, oldValue); } else { this.$TemplateBasedWidget.setWidgetProperty.apply(this, arguments); } }
javascript
{ "resource": "" }
q56707
train
function (optionIndex) { if (this._subTplCtxt) { var data = this._subTplModuleCtrl.getData(); if (data.waiAria && optionIndex > -1 && optionIndex < data.items.length) { return this._subTplCtxt.$getId(data.listItemDomIdPrefix + optionIndex); } } }
javascript
{ "resource": "" }
q56708
train
function (cb) { var hcC = this._hashChangeCallbacks; if (hcC != null) { var len = hcC.length, i = 0; while (i < len && hcC[i] != cb) { i++; } if (i < len) { hcC.splice(i, 1); if (hcC.length === 0) { this._hashChangeCallbacks = null; this._removeHashChangeInternalCallback(); } } } }
javascript
{ "resource": "" }
q56709
train
function (hashObject) { var hashStringArray = []; for (var key in hashObject) { if (hashObject.hasOwnProperty(key)) { hashStringArray.push(encodeURIComponent(key) + "=" + encodeURIComponent(hashObject[key])); } } return hashStringArray.join(this._separators[0]); }
javascript
{ "resource": "" }
q56710
train
function (hashString) { var pairs = hashString, hashObject = {}, currentPair, currentPairString; pairs = (pairs) ? pairs.split(this._separatorRegExp) : []; for (var i = 0, size = pairs.length; size > i; i++) { currentPairString = pairs[i]; currentPair = decodeURIComponent(currentPairString).split("="); if (currentPair.length == 2) { hashObject[currentPair[0]] = currentPair[1]; } else { if (currentPairString.indexOf("=") == currentPairString.length) { hashObject[currentPair[0]] = ""; } else { hashObject["param" + i] = currentPair[0]; } } } return hashObject; }
javascript
{ "resource": "" }
q56711
train
function () { if (!this._isIE7OrLess) { this._hashChangeCallbackAdded = true; ariaUtilsAriaWindow.attachWindow(); ariaUtilsEvent.addListener(Aria.$window, 'hashchange', { fn : this._internalCallback, scope : this }, true); } }
javascript
{ "resource": "" }
q56712
train
function () { if (this._enableIEpolling) { this._hashPollCallback = ariaCoreTimer.addCallback({ fn : this._hashPoll, scope : this, delay : this.ie7PollDelay }); var documentHash = this.getHashString(); var iframeHash = this.polledIframeHashString; // back or forward if (iframeHash != this._currentIframeHashString) { this._currentIframeHashString = iframeHash; this._currentHashString = iframeHash; this.setHash(iframeHash); this._internalCallback(); } else if (documentHash != this._currentHashString) {// no back or forward this._addIframeHistoryEntry(documentHash); this._internalCallback(); } } }
javascript
{ "resource": "" }
q56713
train
function () { var callbacks = this._hashChangeCallbacks, cb; if (callbacks == null) { return; } this._currentHashString = this.getHashString(); var currentHashObject = this._extractHashObject(this._currentHashString); for (var i = 0, size = callbacks.length; size > i; i++) { cb = callbacks[i]; cb = this.$normCallback(cb); this.$callback(cb, currentHashObject); } }
javascript
{ "resource": "" }
q56714
train
function () { if (!this._isIE7OrLess && this._hashChangeCallbackAdded) { this._hashChangeCallbackAdded = false; ariaUtilsEvent.removeListener(Aria.$window, 'hashchange', { fn : this._internalCallback }); ariaUtilsAriaWindow.detachWindow(); } }
javascript
{ "resource": "" }
q56715
train
function (hashObject) { var prop, re = this._nonEncodableSepRegExp; for (var key in hashObject) { if (hashObject.hasOwnProperty(key)) { if (re && key.match(re)) { this.$logError(this.INVALID_HASHOBJECT_KEY, [key, this._nonEncodableSeparators.join("")]); return false; } else { prop = hashObject[key]; if (this._typeUtil.isString(prop)) { if (re && prop.match(re)) { this.$logError(this.INVALID_HASHOBJECT_VALUE, [prop, key, this._nonEncodableSeparators.join("")]); return false; } } else { this.$logError(this.INVALID_HASHOBJECT_TYPE, key); return false; } } } } return true; }
javascript
{ "resource": "" }
q56716
train
function (sep) { var nonEncodedSep = []; for (var i = 0, len = sep.length; i < len; i++) { if (sep[i] == encodeURIComponent(sep[i])) { nonEncodedSep.push(sep[i]); } } return nonEncodedSep; }
javascript
{ "resource": "" }
q56717
train
function (arg) { var specialCharRegExp = /([\^\$\.\*\+\?\=\!\:\|\\\/\(\)\[\]\{\}]){1,1}/g; var regexpStringArray = []; for (var i = 0, len = arg.length; i < len; i++) { regexpStringArray.push(arg[i].replace(specialCharRegExp, "\\$1")); } if (regexpStringArray.length === 0) { return null; } else { return new RegExp(regexpStringArray.join("|")); } }
javascript
{ "resource": "" }
q56718
train
function () { var iframe, document = Aria.$window.document; iframe = document.createElement('iframe'); iframe.setAttribute('id', this.IFRAME_ID); iframe.style.display = 'none'; document.body.appendChild(iframe); this._iframe = iframe; this.polledIframeHashString = this._currentHashString; this._addIframeHistoryEntry(this._currentHashString); }
javascript
{ "resource": "" }
q56719
train
function (hash) { var iframe = this._iframe; if (!iframe) { return; } hash = hash || ""; if (this._currentIframeHashString != hash) { var src = ['javascript:document.open();']; src.push('document.write(\"<script type=\\\"text/javascript\\\">'); if (Aria.domain) { src.push('document.domain=\\\"' + Aria.domain + '\\\";'); } src.push('if (parent.' + this.$classpath + '){parent.' + this.$classpath + '.polledIframeHashString=\\\"' + hash + '\\\";}'); src.push("</script>\");"); src.push('document.close();'); iframe.src = src.join(""); this._currentIframeHashString = hash; } }
javascript
{ "resource": "" }
q56720
train
function (widget, domEvt) { if (!this._cfgOk) { return; } if (this._popup && this._associatedWidget == widget) { this._popup.cancelMouseOutTimer(); } if (!this._showTimeout) { this._showTimeout = timer.addCallback({ scope : this, fn : this.showTooltip, args : { widget : widget, absolutePosition : { left : domEvt.clientX, top : domEvt.clientY } }, delay : this._cfg.showDelay }); } }
javascript
{ "resource": "" }
q56721
train
function (widget, domEvt) { if (!this._cfgOk) { return; } if (this._showTimeout && this._cfg.showOnlyOnMouseStill) { timer.cancelCallback(this._showTimeout); this._showTimeout = timer.addCallback({ scope : this, fn : this.showTooltip, args : { widget : widget, absolutePosition : { left : domEvt.clientX, top : domEvt.clientY } }, delay : this._cfg.showDelay }); } }
javascript
{ "resource": "" }
q56722
train
function (widget, domEvt) { if (!this._cfgOk) { return; } if (this._popup) { this._popup.closeOnMouseOut(domEvt); } if (this._showTimeout) { timer.cancelCallback(this._showTimeout); this._showTimeout = null; } }
javascript
{ "resource": "" }
q56723
train
function (args, cb) { this.setData(args.dataModel); var itemsInfo = args.itemsInfo; var res = this._mergeItemsAndSelectionInfo(itemsInfo.items, itemsInfo.selectedValues, itemsInfo.selectedIndex); this._setItems(res.items); this.json.setValue(this._data, "selectedIndex", res.selectedIndex); this.json.setValue(this._data, "selectedCount", res.selectedCount); // this.json.setValue(this._data, "selectedValues", res.selectedValues); if (itemsInfo.selectedValues == null) { this.setSelectedIndex(itemsInfo.selectedIndex); } var itemsView = new ariaTemplatesView(this._data.items); this.json.setValue(this._data, "itemsView", itemsView); if (this._data.activateSort) { itemsView.setSort(itemsView.SORT_ASCENDING, "sortByLabel", this._sortByLabel); } this.$callback(cb); }
javascript
{ "resource": "" }
q56724
train
function (selectedIdx) { if (!this._navigationEvent) { // will not override any selections using arrow keys or mouse over if (this._data.preselect === "none") { return null; } else if (this._data.preselect === "always") { if (selectedIdx === -1 || selectedIdx === undefined) { selectedIdx = 0; } return selectedIdx; } } else { this._navigationEvent = false; } }
javascript
{ "resource": "" }
q56725
train
function (itemsList) { var selectedCount = this._data.selectedCount; var maxSelectedCount = this._getTrueMaxSelectedCount(); for (var i = 0, l = itemsList.length; i < l; i++) { var item = itemsList[i]; var res = item.initiallyDisabled; if (!res && selectedCount >= maxSelectedCount) { res = !item.selected; } this.json.setValue(item, "currentlyDisabled", res); } }
javascript
{ "resource": "" }
q56726
train
function (itemIndex) { this._stopUpdates(); var json = this.json; var data = this._data; var itemsList = data.items; var item = itemsList[itemIndex]; var isSelected = item.selected; // Needed to optimize the template var newlySelectedIndexes = []; var newlyUnselectedIndexes = []; // items for which _updateCurrentlyDisabled will be called: var changedItems = [item]; var maxSelectedCount = this._getTrueMaxSelectedCount(); var previousSelectedCount = data.selectedCount; var newSelectedIndex = data.selectedIndex; var newSelectedCount = previousSelectedCount; this.$assert(149, maxSelectedCount >= previousSelectedCount); // now we need to update the selectedIndex and selectedCount properties // and also the selection of other items (if max selected count has been reached) if (isSelected) { newlySelectedIndexes[0] = itemIndex; newSelectedCount++; if (newSelectedCount > maxSelectedCount) { // selecting a new item would be a problem, we need to unselect another item for this to work var selectedIndexes = this.getSelectedIndexes(); // this may or may not contain itemIndex // (depending on selectedIndex) for (var i = 0, len = selectedIndexes.length; i < len; i++) { var indexSelected = selectedIndexes[i]; if (indexSelected != itemIndex) { // do not unselect the item that has just been selected var itemToUnselect = itemsList[indexSelected]; // check initiallyDisabled so that programmatically disabled items cannot be unselected // here if (!itemToUnselect.initiallyDisabled) { // we found an item to unselect newSelectedCount--; newlyUnselectedIndexes[0] = indexSelected; json.setValue(itemToUnselect, "selected", false); changedItems.push(itemToUnselect); break; } } } this.$assert(182, newSelectedCount == maxSelectedCount); // we must have found an item to // unselect } if (newSelectedCount === 1) { newSelectedIndex = itemIndex; } else { // more than 1 selected item newSelectedIndex = null; } } else { newlyUnselectedIndexes[0] = itemIndex; newSelectedCount--; if (newSelectedCount === 0) { this.$assert(194, newSelectedIndex == itemIndex); // it was the only selected item newSelectedIndex = -1; } else if (newSelectedCount === 1) { // one remaining selected item, need to find which one var selectedIndexes = this.getSelectedIndexes(); this.$assert(202, selectedIndexes.length == 1); newSelectedIndex = selectedIndexes[0]; } else { // more than one remaining selected item, nothing to do with newSelectedIndex this.$assert(203, newSelectedCount > 1); this.$assert(204, newSelectedIndex == null); } } json.setValue(data, "selectedIndex", newSelectedIndex); json.setValue(data, "selectedCount", newSelectedCount); if ((newSelectedCount != previousSelectedCount) && (previousSelectedCount == maxSelectedCount || newSelectedCount == maxSelectedCount)) { // the number of selected items has changed, and it either the old or the new number is the maximum // number // update all disabled information this._updateCurrentlyDisabled(itemsList); } else { this._updateCurrentlyDisabled(changedItems); } this._resumeUpdates(); // after everything is updated, send the event: this._raiseOnChangeEvent(newlySelectedIndexes, newlyUnselectedIndexes); }
javascript
{ "resource": "" }
q56727
train
function (items, selectedValues, selectedIdx) { var arrayUtil = ariaUtilsArray; var preselect = this._checkPreselect(selectedIdx); selectedIdx = (preselect === undefined) ? selectedIdx : preselect; var maxSelectedCount = this._getTrueMaxSelectedCount(items); var pbMaxSelected = false; // true if the number of selected values is greater than maxSelectedCount // Items can be taken directly from the array or from another array // Identify from which container we'll take the items and from which properties. var container = items; var labelProperty = "label"; var ariaLabelProperty = "ariaLabel"; var valueProperty = "value"; var disabledProperty = "disabled"; if (!ariaUtilsType.isArray(items)) { container = items.container; labelProperty = items.labelProperty; ariaLabelProperty = items.ariaLabelProperty; valueProperty = items.valueProperty; disabledProperty = items.disabledProperty; } // Merge the item data and info about selection in one array for simpler template construction var listItems = []; var selectedIndex = -1; var selectedCount = 0; for (var item = 0, length = container.length; item < length; item++) { var itemObj = container[item]; var itemSelected = selectedValues ? arrayUtil.contains(selectedValues, itemObj[valueProperty]) || selectedIdx === item : false; if (items[item].disabled) { itemSelected = false; } if (itemSelected) { if (selectedCount < maxSelectedCount) { selectedCount++; if (selectedIndex != null) { if (selectedIndex == -1) { selectedIndex = item; // only one item is selected } else { selectedIndex = null; // multiple items are selected } } } else { pbMaxSelected = true; // we do as if this item was not selected, as we have reached the // maximum number of selected items itemSelected = false; } } var initiallyDisabled = disabledProperty ? itemObj[disabledProperty] : false; listItems[item] = { index : item, label : itemObj[labelProperty], ariaLabel : itemObj[ariaLabelProperty], value : itemObj[valueProperty], object : itemObj, selected : itemSelected, initiallyDisabled : initiallyDisabled, currentlyDisabled : initiallyDisabled // currentlyDisabled will be updated at the end if the maximum number of selected items has been // reached }; } // check if the maximum number of items has been reached: if (selectedCount == maxSelectedCount) { // in this case, all the unselected items must be disabled: for (var item = 0, length = listItems.length; item < length; item++) { if (!listItems[item].selected) { listItems[item].currentlyDisabled = true; } } } // In case of single selection mode, we keep track of the current selected index // to avoid looping through all elements when doing new selection. return { items : listItems, pbMaxSelected : pbMaxSelected, selectedIndex : selectedIndex, selectedCount : selectedCount }; }
javascript
{ "resource": "" }
q56728
train
function (flowOrientation, focusIndex, numberOfRows, numberOfColumns, keyCode, numberItems) { var moveFocus = focusIndex; if (numberOfColumns == 1) { if (keyCode == ariaDomEvent.KC_ARROW_UP) { moveFocus--; } if (keyCode == ariaDomEvent.KC_ARROW_DOWN) { moveFocus++; } } else { if (keyCode == ariaDomEvent.KC_ARROW_UP) { if (flowOrientation == 'vertical') { moveFocus = focusIndex - 1; } else { if (focusIndex - numberOfColumns < 0) { moveFocus = focusIndex--; } else { moveFocus = focusIndex - numberOfColumns; } } } else if (keyCode == ariaDomEvent.KC_ARROW_DOWN) { if (flowOrientation == 'vertical') { moveFocus = focusIndex + 1; } else { if (numberOfColumns < numberItems - focusIndex) { moveFocus = focusIndex + numberOfColumns; } else { return focusIndex; } } } else if (keyCode == ariaDomEvent.KC_ARROW_LEFT) { if (flowOrientation == 'horizontal') { moveFocus = focusIndex - 1; } else { if (focusIndex >= numberOfRows) { moveFocus = focusIndex - numberOfRows; } else { return focusIndex; } } } else if (keyCode == ariaDomEvent.KC_ARROW_RIGHT) { if (flowOrientation == 'horizontal') { moveFocus = focusIndex + 1; } else { if (numberOfColumns < numberItems - focusIndex) { moveFocus = focusIndex + numberOfRows; } else { return focusIndex; } } } } if (moveFocus >= numberItems) { return numberItems - 1; } else if (moveFocus < 0) { return 0; } else { return moveFocus; } }
javascript
{ "resource": "" }
q56729
train
function (evtInfo) { var data = this._data; var evt = { name : "keyevent", charCode : evtInfo.charCode, keyCode : evtInfo.keyCode, focusIndex : data.focusIndex, cancelDefault : false }; this.$raiseEvent(evt); if (data && !evt.cancelDefault) { var moveFocus, itemsView = data.itemsView; if (ariaDomEvent.isNavigationKey(evt.keyCode)) { this._navigationEvent = true; var startIndex = data.multipleSelect ? data.focusIndex : data.selectedIndex > -1 ? itemsView.getNewIndex(itemsView.items, data.selectedIndex) : data.selectedIndex, isFocusable = false, oldFocus = startIndex; moveFocus = startIndex; while (!isFocusable) { moveFocus = this.calcMoveFocus(data.displayOptions.flowOrientation, moveFocus, data.numberOfRows, data.numberOfColumns, evt.keyCode, data.itemsView.items.length); if (oldFocus == moveFocus) { // Tried to move on to a disabled box that cannot be skipped because it's on the edge of // the container moveFocus = startIndex; isFocusable = true; } else { // do not check for single selection as all other are disabled (max item is set to one, // to be refactored properly, in a way that makes sens) isFocusable = !data.multipleSelect || !itemsView.initialArray[itemsView.items[moveFocus].initIndex].currentlyDisabled; } oldFocus = moveFocus; } } else { var moveFocus = data.focusIndex; } if (data.multipleSelect) { evt.cancelDefault = this.setFocusedIndex(moveFocus); } else if (data.selectedIndex != null) { this.setSelectedIndex(moveFocus > -1 ? itemsView.items[moveFocus].initIndex : moveFocus); } evt.cancelDefault = true; } return evt.cancelDefault; }
javascript
{ "resource": "" }
q56730
train
function (newValue) { var data = this._data; if (newValue == null) { // a null value is allowed for the selectedIndex property, but it cannot be used to set the property // as it means several items are selected and we do not know which ones // just ignore the null value return; } var items = data.items; if (newValue < 0) { return false; } else if (newValue >= items.length) { return false; } else { this.json.setValue(data, "focusIndex", newValue); this.setFocus(data.focusIndex); return true; } }
javascript
{ "resource": "" }
q56731
train
function (itemIndex, alreadyChanged) { var data = this._data; itemIndex = parseInt(itemIndex, 10); // it will most likely be a string before the conversion if (isNaN(itemIndex) || itemIndex < 0 || itemIndex > data.items.length) { return; // ignore wrong values of itemIndex } var newIndex; if (data.itemsView) { newIndex = this._data.itemsView.getNewIndex(data.itemsView.items, itemIndex); } else { newIndex = itemIndex; } this.setFocusedIndex(newIndex); if (alreadyChanged == null) { alreadyChanged = false; } var item = data.items[itemIndex]; var evt = { name : "itemClick", index : itemIndex, item : item, value : item.value, alreadyChanged : alreadyChanged }; this.$raiseEvent(evt); // Warning: this._data below shouldn't be changed to a local variable as this._data can be disposed in // some cases and it's needed in toggleSection if (this._data && !evt.cancelDefault && !alreadyChanged) { // we check this._data because because in the click event, the list controller // may have been disposed (e.g. in the selectBox) this.toggleSelection(itemIndex); } }
javascript
{ "resource": "" }
q56732
train
function (itemIndex) { var data = this._data; itemIndex = parseInt(itemIndex, 10); // it will most likely be a string before the conversion if (isNaN(itemIndex) || itemIndex < 0 || itemIndex > data.items.length) { return; // ignore wrong values of itemIndex } var item = data.items[itemIndex]; this._navigationEvent = true; var evt = { name : "itemMouseOver", index : itemIndex, item : item, value : item.value }; this.$raiseEvent(evt); }
javascript
{ "resource": "" }
q56733
train
function (itemIndex) { // Don't do anything if the widget is disabled if (!this._data.disabled) { var newVal = !this._data.items[itemIndex].selected; this.setSelection(itemIndex, newVal); return newVal; } else { return this._data.items[itemIndex].selected; } }
javascript
{ "resource": "" }
q56734
train
function (newValues) { var arrayUtil = ariaUtilsArray; this._stopUpdates(); var newlySelectedIndexes = []; var newlyUnselectedIndexes = []; // Loop through all of the items and update the selection status for each item, // depending on the new array of selected values var selectedIndex = -1; var data = this._data; var items = data.items; var maxSelectedCount = this._getTrueMaxSelectedCount(items); var selectedCount = 0; for (var idx = 0, length = items.length; idx < length; idx++) { var item = items[idx]; var selected = arrayUtil.contains(newValues, item.value); if (selected) { if (selectedCount == maxSelectedCount) { // cancel selection when there is more than what is allowed selected = false; } else if (selectedIndex == -1) { selectedCount = 1; selectedIndex = idx; } else { selectedCount++; selectedIndex = null; } } if (data.preselect === "none" || item.selected != selected) { // selection has changed (selected ? newlySelectedIndexes : newlyUnselectedIndexes).push(idx); this.json.setValue(items[idx], "selected", selected); } } this.json.setValue(data, "selectedIndex", selectedIndex); this.json.setValue(data, "selectedCount", selectedCount); // James removed this because if more than one item is selected, data. selectedIndex is set to null. // Also, in the case of the multi-select we don't necessarily // Want to focus a selected item - need to check this on the list. // this.json.setValue(data, "focusIndex", selectedIndex); // this.setFocus(data.focusIndex); this._updateCurrentlyDisabled(items); this._resumeUpdates(); if (newlySelectedIndexes.length > 0 || newlyUnselectedIndexes.length > 0) { this._raiseOnChangeEvent(newlySelectedIndexes, newlyUnselectedIndexes); } }
javascript
{ "resource": "" }
q56735
train
function (newValue) { if (newValue == null) { // a null value is allowed for the selectedIndex property, but it cannot be used to set the property // as it means several items are selected and we do not know which ones // just ignore the null value return; } var items = this._data.items; if (newValue < 0 || newValue >= items.length) { // unselect all values in case newValue is -1 or invalid this.setSelectedValues([]); } else { this.setSelectedValues([items[newValue].value]); } }
javascript
{ "resource": "" }
q56736
train
function () { var data = this._data; if (data.selectedIndex == -1) { // no item is selected return []; } else if (data.selectedIndex != null) { return [data.selectedIndex]; } else { var retVal = []; // we iterate over the view, so that we return indexes in the order visible to the user: var view = data.itemsView; view.refresh(); // in case there are changes in the view, refresh it var items = view.items; for (var idx = 0, length = items.length; idx < length; idx++) { if (items[idx].value.selected) { // retVal.push(idx); retVal.push(items[idx].initIndex); } } return retVal; } }
javascript
{ "resource": "" }
q56737
train
function () { var selectedIndexes = this.getSelectedIndexes(); var retVal = []; var items = this._data.items; for (var i = 0, length = selectedIndexes.length; i < length; i++) { retVal[i] = items[selectedIndexes[i]]; } return retVal; }
javascript
{ "resource": "" }
q56738
train
function (newlySelectedIndexes, newlyUnselectedIndexes) { var data = this._data; if (newlySelectedIndexes.length === 0 && data.selectedCount === 0) { var preselect = this._checkPreselect(); if (preselect != null) { newlySelectedIndexes = [preselect]; this.json.setValue(data.itemsView.items[preselect].value, "selected", true); this.json.setValue(data, "selectedIndex", preselect); this.json.setValue(data, "selectedCount", 1); } } this.$raiseEvent({ name : "onChange", selectedIndexes : newlySelectedIndexes, unselectedIndexes : newlyUnselectedIndexes }); }
javascript
{ "resource": "" }
q56739
train
function (flowOrientation, numberOfRows, numberOfCols, noItems) { var numItemsLastCol; if (flowOrientation == 'vertical') { if (!numberOfRows) { if (numberOfCols) { numberOfRows = Math.ceil(noItems / numberOfCols); // Now make sure the number of cols they've passed is correct numberOfCols = Math.ceil(noItems / numberOfRows); } else { numberOfCols = 1; numberOfRows = noItems; } } else { numberOfCols = Math.ceil(noItems / numberOfRows); numItemsLastCol = noItems % numberOfRows; } } else if (flowOrientation == 'horizontal') { if (!numberOfCols) { if (numberOfRows) { numberOfCols = Math.ceil(noItems / numberOfRows); // Now make sure the number of rows they've passed is correct numberOfRows = Math.ceil(noItems / numberOfCols); } else { numberOfRows = 1; numberOfCols = noItems; } } else { numberOfRows = Math.ceil(noItems / numberOfCols); } } this.json.setValue(this._data, "numberOfRows", numberOfRows); this.json.setValue(this._data, "numberOfColumns", numberOfCols); }
javascript
{ "resource": "" }
q56740
train
function () { var selected = []; var items = this._data.items; for (var i = 0; i < items.length; i++) { if (!items[i].initiallyDisabled) { selected.push(items[i].value); } } this.setSelectedValues(selected); if (this._data) { this.json.setValue(this._data, "focusIndex", 0); } }
javascript
{ "resource": "" }
q56741
train
function (url, force) { if (force || this._timestampURL[url]) { var timestamp = (new Date()).getTime(); if (url.indexOf("?") != -1) { return url + "&timestamp=" + timestamp; } else { return url + "?timestamp=" + timestamp; } } else { return url; } }
javascript
{ "resource": "" }
q56742
train
function (urls) { if (this._typeUtils.isString(urls)) { urls = [urls]; } var _getPackages = function (urls, urlMap, packages) { if (urls.length === 0) { // everything has been found, leave back the recursive loop return; } for (var key in urlMap) { var value = urlMap[key]; if (typeof(value) == 'string') { value = "/" + value; // Check if something match for (var i = 0, ii = urls.length; i < ii; i++) { var file = urls[i]; if (value.substr(0, file.length) == file) { packages[value] = true; // remove found item from the url list, for performance reason urls.slice(i, i); break; } } } else { _getPackages(urls, urlMap[key], packages); } } }; // Clone urls array var urlClone = []; for (var i = 0, ii = urls.length; i < ii; i++) { urlClone.push(urls[i]); } var packages = {}; _getPackages(urls, this._urlMap, packages); // return the keys only var keys = []; for (var key in packages) { keys.push(key); } return keys; }
javascript
{ "resource": "" }
q56743
train
function (map, pathparts, doubleStar) { for (var i = 0, l = pathparts.length; i < l; i++) { var part = pathparts[i]; if (!this._typeUtils.isObject(map) || this._typeUtils.isInstanceOf(map, 'aria.core.JsObject')) { break; } if (!map[part]) { if (doubleStar) { if (map['*'] && i == l - 1) { map = map['*']; } else { map = map['**']; } } else { map = map['*']; } break; } map = map[part]; } return { node : map, index : i }; }
javascript
{ "resource": "" }
q56744
train
function (evt) { var loader = evt.src, cache = this._cache, itm, lps = loader.getLogicalPaths(); if (lps) { // remove loader ref from all 'files' entries var sz = lps.length; for (var i = 0; sz > i; i++) { itm = cache.getItem("files", lps[i], false); if (itm) { this.$assert(120, itm.loader == loader); itm.loader = null; } } } // remove entry from "urls" category itm = cache.getItem("urls", loader.getURL(), false); if (itm) { this.$assert(128, itm.loader == loader); itm.loader = null; itm.status = this._cache.STATUS_AVAILABLE; } // dispose loader.$dispose(); }
javascript
{ "resource": "" }
q56745
train
function (logicalPath, content, hasErrors) { var itm = this._cache.getItem("files", logicalPath, true); if (hasErrors) { itm.status = this._cache.STATUS_ERROR; } else { itm.value = content; itm.status = this._cache.STATUS_AVAILABLE; } if (this.lastLoadedFiles) { this.lastLoadedFiles[logicalPath] = 1; } }
javascript
{ "resource": "" }
q56746
train
function (logicalPath) { var itm = this._cache.getItem("files", logicalPath, false); if (itm && itm.status == this._cache.STATUS_AVAILABLE) { return itm.value; } return null; }
javascript
{ "resource": "" }
q56747
train
function (classpath, cb) { var logicalPath = Aria.getLogicalPath(classpath, ".tpl", true); this.loadFile(logicalPath, { fn : this._onTplFileContentReceive, scope : this, args : { origCb : cb } }, null); }
javascript
{ "resource": "" }
q56748
train
function (evt, args) { var res = { content : null }; if (evt.downloadFailed) { res.downloadFailed = evt.downloadFailed; } if (evt.logicalPaths.length > 0) { res.content = this.getFileContent(evt.logicalPaths[0]); } this.$callback(args.origCb, res); }
javascript
{ "resource": "" }
q56749
train
function (logicalPath, timestampNextTime) { var content = this._cache.content; delete content.files[logicalPath]; var url = this.resolveURL(logicalPath); delete content.urls[url]; if (timestampNextTime) { this.enableURLTimestamp(url, true); // browser cache will be bypassed next time the file is loaded } }
javascript
{ "resource": "" }
q56750
train
function (cb, evt) { if (this._syncLoadCounter < this.MAX_LOAD_STACK) { this._syncLoadCounter++; this.$callback(cb, evt); this._syncLoadCounter--; } else { var self = this; Aria.$global.setTimeout(function () { self.$callback(cb, evt); self = cb = evt = null; }, 0); } }
javascript
{ "resource": "" }
q56751
train
function (info) { if (info.step == "CallBegin" && !aria.templates.ModuleCtrl.prototype[info.method]) { ariaTemplatesRefreshManager.stop(); } var evt = { name : "method" + info.step, /* * info.step contains either CallBegin, CallEnd or Callback */ method : info.method }; this.$raiseEvent(evt); if (info.step == "CallEnd" && !aria.templates.ModuleCtrl.prototype[info.method]) { ariaTemplatesRefreshManager.resume(); } }
javascript
{ "resource": "" }
q56752
train
function (targetService, jsonData, cb, options) { var typeUtils = ariaUtilsType; // change cb as an object if a string or a function is passed as a // callback if (typeUtils.isString(cb) || typeUtils.isFunction(cb)) { var ncb = { fn : cb, scope : this }; cb = ncb; } else if (typeUtils.isObject(cb) && cb.scope == null) { cb.scope = this; // default scope = this } if (!options) { options = {}; } var wrapCB = { fn : this._submitJsonRequestCB, scope : this, args : { cb : cb } }; // Request object constructed with all necessary properties var requestObject = { moduleName : this.$package, session : this._session, actionQueuing : null, requestHandler : this.$requestHandler, urlService : this.$urlService, requestJsonSerializer : this.$requestJsonSerializer, async : options.async, timeout : options.timeout, headers : options.headers }; if (typeUtils.isString(targetService)) { requestObject.actionName = targetService; } else { requestObject.serviceSpec = targetService; } ariaModulesRequestMgr.submitJsonRequest(requestObject, jsonData, wrapCB); }
javascript
{ "resource": "" }
q56753
train
function (evt, args) { var smList = this._smList; if (smList) { // smList can be null if the module is in the process of being disposed for (var i = 0, l = smList.length; i < l; i++) { if (smList[i] == evt.src) { ariaUtilsArray.removeAt(smList, i); if (evt.reloadingObject) { evt.reloadingObject.$onOnce({ "objectLoaded" : { scope : this, fn : this.__onSubModuleReloaded } }); } break; } } } }
javascript
{ "resource": "" }
q56754
train
function (smList, cb) { // sub-module creation is now entirely managed in ModuleCtrlFactory // simple shortcut for aria.templates.ModuleCtrlFactory.loadSubModules ariaTemplatesModuleCtrlFactory.__loadSubModules(this, smList, { fn : this.__onLoadSubModulesComplete, scope : this, args : cb }); }
javascript
{ "resource": "" }
q56755
train
function (res, cb) { var subModules = res.subModules; if (subModules && subModules.length > 0) { if (!this._smList) { this._smList = []; } this._smList = this._smList.concat(res.subModules); } this.$callback(cb, res); }
javascript
{ "resource": "" }
q56756
train
function (data, merge) { this.json.inject(data, this._data, merge); if (this._dataBeanName) { if (!ariaCoreJsonValidator.normalize({ json : this._data, beanName : this._dataBeanName })) { this.$logError(this.DATA_CONTENT_INVALID, [this._dataBeanName, this.$classpath]); } } }
javascript
{ "resource": "" }
q56757
train
function () { var res = this.__resources; if (!res) { var src = this.$resources; if (src) { this.__resources = res = {}; for (var itm in src) { if (src.hasOwnProperty(itm)) { res[itm] = this[itm]; } } } } return res; }
javascript
{ "resource": "" }
q56758
train
function (dataToFind) { if (this._smList) { var sz = this._smList.length; for (var i = 0; i < sz; i++) { var subModule = this._smList[i]; if (subModule && dataToFind == subModule.getData()) { return subModule; } } } return this.$publicInterface(); }
javascript
{ "resource": "" }
q56759
train
function (session) { this._session = session; if (this._smList) { var sz = this._smList.length; for (var i = 0; i < sz; i++) { var subModule = this._smList[i]; if (subModule) { subModule.setSession(session); } } } }
javascript
{ "resource": "" }
q56760
train
function (domEvt) { var DomWrapper = ariaTemplatesDomElementWrapper; this.$DomEvent.constructor.call(this, domEvt); /** * Wrapper on the HTML element on which the event happened. * @type aria.templates.DomElementWrapper */ this.target = (this.target ? new DomWrapper(this.target) : null); /** * Wrapper on the HTML element from/to which the event is directed. (relatedTarget/fromElement/toElement) * @type aria.templates.DomElementWrapper */ this.relatedTarget = (this.relatedTarget ? new DomWrapper(this.relatedTarget) : null); // bind function to original scope so that "this" is preserved // Not needed as $DomEvent constructor creates these functions // this.stopPropagation = aria.utils.Function.bind(domEvt.stopPropagation, domEvt); // this.preventDefault = aria.utils.Function.bind(domEvt.preventDefault, domEvt); }
javascript
{ "resource": "" }
q56761
train
function (location, key, value, old, nspace) { this.$raiseEvent({ name : "change", location : location, namespace : nspace, key : key, newValue : value, oldValue : old, url : Aria.$window.location }); }
javascript
{ "resource": "" }
q56762
train
function (out) { // --------------------------------------------------- destructuring var cfg = this._cfg; var icon = cfg.icon; var tooltip = cfg.tooltip; var tabIndex = cfg.tabIndex; var waiAria = cfg.waiAria; var label = cfg.label; var role = cfg.role; var id = this._domId; var iconInfo = this._iconInfo; var extraAttributes = this.extraAttributes; // ------------------------------------------------------ processing var attributes = []; function addAttribute(key, value) { value = '' + value; value = ariaUtilsString.escapeForHTML(value, {attr: true}); attributes.push(key + '="' + value + '"'); attributes.push(subst('%1="%2"', key, value)); } // delegationMarkup ------------------------------------------------ var delegateManager = aria.utils.Delegate; var delegateId = this._delegateId; if (!delegateId) { delegateId = delegateManager.add({ fn : this.delegate, scope : this }); this._delegateId = delegateId; } var delegationMarkup = delegateManager.getMarkup(delegateId); // icon ------------------------------------------------------------ addAttribute('id', id); var style = null; if (!iconInfo.spriteURL && icon) { var parts = icon.split(":"); var skinclass = parts[0]; var contentKey = parts[1]; var classes = aria.widgets.AriaSkinInterface.getSkinObject("Icon", skinclass, true).content[contentKey]; addAttribute('class', ['xWidget'].concat(classes).join(' ')); } else { addAttribute('class', this._getIconClasses(iconInfo)); if (tooltip != null && tooltip !== '') { tooltip = addAttribute('title', tooltip); } attributes.push(delegationMarkup); style = this._getIconStyle(iconInfo); } if (tabIndex != null) { tabIndex = this._calculateTabIndex(); addAttribute('tabindex', tabIndex); } if (waiAria && label) { addAttribute('aria-label', label); } if (waiAria && role) { addAttribute('role', role); } if (style) { addAttribute('style', style); } attributes.push(extraAttributes); attributes = attributes.join(' '); var markup = '<span ' + attributes + '></span>'; // ---------------------------------------------------------- output out.write(markup); }
javascript
{ "resource": "" }
q56763
train
function (newIcon) { // check if initialization was successful if (!this._iconInfo) { return; } var iconInfo = this._getIconInfo(newIcon); // check if (iconInfo) { var domElt = this.getDom(); domElt.style.cssText = this._getIconStyle(iconInfo); domElt.className = this._getIconClasses(iconInfo); } this._iconInfo = iconInfo; }
javascript
{ "resource": "" }
q56764
train
function (icon) { var iconParts = icon.split(":"); if (iconParts.length !== 2) { this.$logError(this.ICON_BADLY_FORMATTED, [icon]); return null; } else { var iconInfo = aria.widgets.AriaSkinInterface.getIcon(iconParts[0], iconParts[1]); if (!iconInfo) { this.$logError(this.ICON_NOT_FOUND, [icon]); return null; } return iconInfo; } }
javascript
{ "resource": "" }
q56765
train
function (iconInfo) { var cfg = this._cfg; var vAlign = !cfg.verticalAlign ? "" : "vertical-align: " + cfg.verticalAlign; var margins = "margin: 0 0 0 0 "; // default value if (cfg.margins != null && cfg.margins.match(/^(\d+|x) (\d+|x) (\d+|x) (\d+|x)$/)) { var margArray = cfg.margins.split(" "); margins = ['margin:', margArray[0], 'px ', margArray[1], 'px ', margArray[2], 'px ', margArray[3], 'px; '].join(''); } else if (iconInfo.margins != null) { margins = iconInfo.margins; } if (cfg.sourceImage) { return [margins, ';padding:0;background:url(', iconInfo.imageURL, ') no-repeat; width:', iconInfo.width, 'px;height:', iconInfo.height, 'px;', vAlign].join(''); } else { return [margins, ';padding:0;background-position:-', iconInfo.iconLeft, 'px -', iconInfo.iconTop, 'px;', vAlign].join(''); } }
javascript
{ "resource": "" }
q56766
train
function (iconInfo) { var cfg = this._cfg; var cssClasses = ariaCoreTplClassLoader.addPrintOptions(this._cssClassNames, cfg.printOptions); if (iconInfo.cssClass) { cssClasses += " " + iconInfo.cssClass; } if (cfg.block) { cssClasses += " xBlock"; } return cssClasses; }
javascript
{ "resource": "" }
q56767
train
function (domEvent) { var cfg = this._cfg; if (cfg) { var domEvtWrapper; if (domEvent) { domEvtWrapper = new aria.templates.DomEventWrapper(domEvent); } var returnValue = this.evalCallback(cfg.onclick, domEvtWrapper); if (domEvtWrapper) { domEvtWrapper.$dispose(); } return returnValue; } return true; }
javascript
{ "resource": "" }
q56768
train
function (htmlElem, properties, cfg) { var animId; cfg = cfg || {}; var elem = this._getHTMLElement(htmlElem), animInfo = { props : [] }; if (elem == null) { this.$logWarn(this.INVALID_HTML_ELEMENT); return null; } animInfo.duration = cfg.duration ? parseInt(cfg.duration, 10) : this.DEFAULT_DURATION; animInfo.interval = cfg.interval ? parseInt(cfg.interval, 10) : this.DEFAULT_INTERVAL; if (cfg.easing != null) { if (ariaUtilsType.isFunction(cfg.easing)) { animInfo.easing = cfg.easing; } else if (ariaUtilsType.isString(cfg.easing)) { animInfo.easing = this._easing[cfg.easing]; } } animInfo.easing = animInfo.easing || this._easing[this.DEFAULT_EASING]; animInfo.queue = (cfg.queue === true) ? this.DEFAULT_QUEUE_KEY : (cfg.queue != null) ? this._getQueueKey(cfg.queue) : false; animInfo.element = elem; animInfo.userProperties = properties; animInfo.onStartAnimation = cfg.onStartAnimation; animInfo.onEndAnimation = cfg.onEndAnimation; animInfo.onEndQueue = cfg.onEndQueue; animInfo.hide = cfg.hide; if (animInfo.queue) { // if it is the first animation of its queue if (!this.queues[animInfo.queue]) { this.queues[animInfo.queue] = { list : [animInfo], onEndQueue : cfg.onEndQueue }; this.$callback(cfg.onStartQueue); animId = this._createAndLaunchAnimation(animInfo); } else { animId = this._createAnimationSpot(); this.queues[animInfo.queue].list.push(animInfo); } } else { animId = this._createAndLaunchAnimation(animInfo); } animInfo.animId = animId; this.animations[animId] = animInfo; return animId; }
javascript
{ "resource": "" }
q56769
train
function (queueId) { var id = queueId; if (queueId == null) { id = this.DEFAULT_QUEUE_KEY; } var queue = this.queues[id]; if (queue && queue.list.length > 0) { var curAnimInfo = queue.list.shift(); for (var i = 1, l = queue.list.length; i < l; i++) { var animInfo = queue.list[i]; delete this.animations[animInfo.animId]; } this.skipAnimation(curAnimInfo.animId); delete this.queues[id]; return true; } return false; }
javascript
{ "resource": "" }
q56770
train
function (idQueue) { var id = idQueue; if (idQueue == null) { id = this.DEFAULT_QUEUE_KEY; } var queue = this.queues[id]; if (queue && queue.list.length > 0 && !queue.list[0].isRunning) { // if first animation in queue has been paused (and not skipped afterwards) if (queue.list[0].pauseTime != null) { this.resumeAnimation(queue.list[0].animId); } else { // if the paused animation has been skipped this._launchAnimation(queue.list[0], queue.list[0].animId); } return true; } return false; }
javascript
{ "resource": "" }
q56771
train
function (valueWithUnit, elem, property) { var unit = this.getUnit(valueWithUnit, property); var value = parseFloat(valueWithUnit, 10); return this.__convertToPixels[unit].call(this, value, elem, property); }
javascript
{ "resource": "" }
q56772
train
function (newUnit, valueInPixels, elem, property) { return this.__convertFromPixels[newUnit].call(this, valueInPixels, elem, property); }
javascript
{ "resource": "" }
q56773
train
function (element, property) { if (this.isIE8orLess) { return element.currentStyle[property] || element.style[property]; } else { return Aria.$window.getComputedStyle(element, "")[property] || element.style[property]; } }
javascript
{ "resource": "" }
q56774
train
function (out) { var typeUtil = ariaUtilsType, placeholderManager = ariaEmbedPlaceholderManager; var placeholderPath = this._placeholderPath; var contents = placeholderManager.getContent(placeholderPath); for (var i = 0, ii = contents.length; i < ii; i++) { var content = contents[i]; if (typeUtil.isString(content)) { out.write(content); } else { // Assume json here (aria.html.beans.TemplateCfg) var template = new ariaHtmlTemplate(content, this._context, this._lineNumber); template.subTplCtxt.placeholderPath = placeholderPath; out.registerBehavior(template); template.writeMarkup(out); } } }
javascript
{ "resource": "" }
q56775
train
function (event) { var paths = event.placeholderPaths; if (ariaUtilsArray.contains(paths, this._placeholderPath)) { var newSection = this._context.getRefreshedSection({ section : this._sectionId, writerCallback : { fn : this._writePlaceholderContent, scope : this } }); this._context.insertSection(newSection); } }
javascript
{ "resource": "" }
q56776
train
function () { var placeholderPath = ""; var currentContext = this._context; while (currentContext) { if (currentContext.placeholderPath) { placeholderPath = currentContext.placeholderPath + "."; break; } currentContext = currentContext.parent; } return placeholderPath + this._cfg.name; }
javascript
{ "resource": "" }
q56777
train
function (search) { findFilterRes = null; findFilterSearch = search; if (typeUtils.isString(search)) { return findByClasspath; } else if (typeUtils.isInstanceOf(search, "aria.core.IOFilter")) { return findByInstance; } else if (typeUtils.isObject(search)) { return findByClasspathAndInitArgs; } else { return null; } }
javascript
{ "resource": "" }
q56778
train
function (newFilter) { var filterInfo = {}; if (typeUtils.isString(newFilter)) { filterInfo.filterClasspath = newFilter; filterInfo.initArgs = null; this._filtersToBeLoaded++; } else if (typeUtils.isInstanceOf(newFilter, "aria.core.IOFilter")) { if (this.isFilterPresent(newFilter)) { this.$logError(this.FILTER_INSTANCE_ALREADY_PRESENT); return false; } filterInfo.filterClasspath = newFilter.$classpath; filterInfo.obj = newFilter; } else if (typeUtils.isObject(newFilter)) { filterInfo.filterClasspath = newFilter.classpath; filterInfo.initArgs = newFilter.initArgs; this._filtersToBeLoaded++; } else { this.$logError(this.INVALID_PARAMETER_FOR_ADDFILTER); return false; } if (!this._filters) { this._filters = []; } this._filters[this._filters.length] = filterInfo; return true; }
javascript
{ "resource": "" }
q56779
train
function (filterDef) { var filters = this._filters; // stop here if there are no filters if (!filters) { return false; } var isWrongFilter = getFindFilterFunction(filterDef); if (isWrongFilter == null) { this.$logError(this.INVALID_PARAMETER_FOR_ISFILTERPRESENT); clean(); return false; } for (var i = 0, l = filters.length; i < l; i++) { if (!isWrongFilter(filters[i])) { clean(); return true; } } clean(); return false; }
javascript
{ "resource": "" }
q56780
train
function (oldFilter) { var filters = this._filters; // stop here if there are no filters if (!filters) { return false; } var selectionCallback = getFindFilterFunction(oldFilter); if (selectionCallback == null) { this.$logError(this.INVALID_PARAMETER_FOR_REMOVEFILTER); clean(); return false; } var newFiltersArray = arrayUtils.filter(filters, selectionCallback, this); clean(); var filterToRemove = findFilterRes; if (filterToRemove) { if (filterToRemove.obj) { // already loaded, dispose it filterToRemove.obj.$dispose(); filterToRemove.obj = null; } else { // not yet loaded, prevent it to be loaded this._filtersToBeLoaded--; } filterToRemove.filterClasspath = null; filterToRemove.initArgs = null; if (newFiltersArray.length === 0) { this._filters = null; } else { this._filters = newFiltersArray; } return true; } return false; }
javascript
{ "resource": "" }
q56781
train
function (isResponse, request, cb) { if (!this._filters) { this.$callback(cb); return; } var args = { isResponse : isResponse, request : request, cb : cb, filters : this._filters, nbFilters : this._filters.length // store the number of filters so that we do not call filters which were added after the call // to _callFilters }; if (this._filtersToBeLoaded > 0 && (request.sender == null || request.sender.classpath != "aria.core.FileLoader")) { this._loadMissingFilters({ fn : this._continueCallingFilters, args : args, scope : this }); } else { this._continueCallingFilters(null, args); } }
javascript
{ "resource": "" }
q56782
train
function (unused, args) { var filters = args.filters; var request = args.request; var curFilter; // initialize the delay request.delay = 0; if (args.isResponse) { for (var i = args.nbFilters - 1; i >= 0; i--) { curFilter = filters[i].obj; if (curFilter) { curFilter.__onResponse(request); } } } else { for (var i = 0, l = args.nbFilters; i < l; i++) { curFilter = filters[i].obj; if (curFilter) { curFilter.__onRequest(request); } } } if (request.delay > 0) { // wait for the specified delay ariaCoreTimer.addCallback({ fn : this._afterDelay, args : args, scope : this, delay : request.delay }); } else { this._afterDelay(args); } }
javascript
{ "resource": "" }
q56783
train
function (cb) { var filters = this._filters; var curFilter; var classpathsToLoad = []; for (var i = 0, l = filters.length; i < l; i++) { curFilter = filters[i]; if (curFilter.obj == null) { classpathsToLoad.push(curFilter.filterClasspath); } } Aria.load({ classes : classpathsToLoad, oncomplete : { fn : this._continueLoadingMissingFilters, scope : this, args : { cb : cb, filters : filters, nbFilters : filters.length } } }); }
javascript
{ "resource": "" }
q56784
train
function (args) { var filters = args.filters; for (var i = 0, l = args.nbFilters; i < l; i++) { var curFilter = filters[i]; // not that filterClasspath can be null if the filter was removed in the meantime. if (curFilter.filterClasspath != null && curFilter.obj == null) { curFilter.obj = Aria.getClassInstance(curFilter.filterClasspath, curFilter.initArgs); this._filtersToBeLoaded--; } } this.$callback(args.cb); }
javascript
{ "resource": "" }
q56785
train
function (propagate) { // PROFILING // this.$logTimestamp("updateContainerSize"); var cfg = this._cfg, domElt = this.getDom(); if (!domElt) { return; } var widthConf = this._getWidthConf(); var heightConf = this._getHeightConf(); if (this._changedContainerSize || this._sizeConstraints) { // if we are bound to min and max size if (this._changedContainerSize) { // when maximized from start, widthMaximized will be empty initially, but it'll be adjusted later var width = cfg.widthMaximized || cfg.width; var height = cfg.heightMaximized || cfg.height; var constrainedWidth = ariaUtilsMath.normalize(width, widthConf.min, widthConf.max); var constrainedHeight = ariaUtilsMath.normalize(height, heightConf.min, heightConf.max); domElt.style.width = width > -1 ? constrainedWidth + "px" : ""; domElt.style.height = height > -1 ? constrainedHeight + "px" : ""; if (this._frame) { // this is required if the frame is being shrinked var frameWidth = width > -1 ? constrainedWidth : -1; var frameHeight = height > -1 ? constrainedHeight : -1; this._frame.resize(frameWidth, frameHeight); } } var changed = ariaUtilsSize.setContrains(domElt, widthConf, heightConf); if (changed && this._frame) { this._frame.resize(changed.width, changed.height); // throws a onchange event on parent if (domElt.parentNode && propagate) { aria.utils.Delegate.delegate(aria.DomEvent.getFakeEvent('contentchange', domElt.parentNode)); } } this._changedContainerSize = changed; } }
javascript
{ "resource": "" }
q56786
train
function () { var elt = this._getInputMarkupDomElt(); if (elt) { this._initInputMarkup(elt); } var lbl = this._getInputLabelMarkupDomElt(); if (lbl) { this._initLabelMarkup(lbl); } }
javascript
{ "resource": "" }
q56787
train
function () { var markup = []; if (this._cfg.waiAria) { var labelledBy = this._cfg.waiLabelledBy; if (this._cfg.waiLabel) { markup.push(' aria-label="' + ariaUtilsString.encodeForQuotedHTMLAttribute(this._cfg.waiLabel) + '" ');} else if (!labelledBy) { labelledBy = this._labelId; } if (labelledBy) { markup.push(' aria-labelledby="' + ariaUtilsString.encodeForQuotedHTMLAttribute(labelledBy) + '" '); } if (this._cfg.waiDescribedBy) { markup.push(' aria-describedby="' + ariaUtilsString.encodeForQuotedHTMLAttribute(this._cfg.waiDescribedBy) + '" '); } } return markup.join(''); }
javascript
{ "resource": "" }
q56788
train
function () { var cfg = this._cfg, showLabel = (!cfg.hideLabel && !!cfg.label), idx; if (showLabel) { idx = ((cfg.labelPos === "right" && !this._fullWidth) || cfg.labelPos === "bottom") ? 0 : 1; } else { idx = 0; } var dom = this.getDom(); if (this._isIE7OrLess) { dom = dom ? dom.firstChild : null; } return ariaUtilsDom.getDomElementChild(dom, idx); }
javascript
{ "resource": "" }
q56789
train
function () { var cfg = this._cfg, showLabel = (!cfg.hideLabel && !!cfg.label); if (showLabel) { var dom = this.getDom(); if (this._isIE7OrLess) { dom = dom ? dom.firstChild : null; } var elems = ariaUtilsDom.getDomElementsChildByTagName(dom, 'label'); if (elems) { if (elems.length === 0) { this.$logError(this.WIDGET_INPUT_NO_LABEL, []); } else if (elems.length == 1) { return elems[0]; } else { this.$logError(this.WIDGET_INPUT_TOO_MANY_LABELS, []); } } } return null; }
javascript
{ "resource": "" }
q56790
train
function () { var label = this.getLabel(); if (label) { label.className = 'x' + this._skinnableClass + '_' + this._cfg.sclass + '_' + this._state + '_label' + this._getFloatingLabelClass(); } }
javascript
{ "resource": "" }
q56791
train
function (cfg) { var metaDataObject, localMetaDataObject, localMetaParam; var toBind = this.automaticallyBindedProperties; var value = null; if (cfg) { if (cfg.bind) { value = cfg.bind.value; // get any binding on the value // property } } if (value && value.inside) { // only add the meta data convention // if a value property has been // bound metaDataObject = ariaUtilsData._getMeta(value.inside, value.to, false); if (!cfg.bind.error) { cfg.bind.error = { "inside" : metaDataObject, "to" : "error" }; } if (!cfg.bind.errorMessages) { cfg.bind.errorMessages = { "inside" : metaDataObject, "to" : "errorMessages" }; } // TODO: need a separation of each widget instances // formatErrorMessages, // currently no way to reference a widget after it has been // disposed. // Once this has been resolved then the widget instance // reference can be used to create special meta to // separate each widgets formatErrorMessages. if (!cfg.bind.formatErrorMessages) { cfg.bind.formatErrorMessages = { "inside" : metaDataObject, "to" : "formatErrorMessages" }; } if (!cfg.bind.requireFocus) { cfg.bind.requireFocus = { "inside" : metaDataObject, "to" : "requireFocus" }; } if (cfg.inputMetaData) { // check to see if the inputMetaData // convention is needed, then add // the meta // data for the rest of the automatic bindings localMetaParam = "local:" + cfg.inputMetaData; localMetaDataObject = metaDataObject[localMetaParam]; if (localMetaDataObject == null) { localMetaDataObject = {}; metaDataObject[localMetaParam] = localMetaDataObject; } for (var i = 0; i < toBind.length; i++) { if (!cfg.bind[toBind[i]]) { // only add a binding if one // doesn't exist cfg.bind[toBind[i]] = { "inside" : localMetaDataObject, "to" : toBind[i] }; } } } } }
javascript
{ "resource": "" }
q56792
train
function (element) { if (this.__focusedElement) { this.removeVisualFocus(); } this.__focusedElement = element; if (this.__style) { var document = Aria.$window.document; // for anchors and buttons it looks better to have the outline property set directly on them. Otherwise // we look for the first span containing the element under focus if (this.__focusedElement.tagName != "A" && this.__focusedElement.tagName != "BUTTON") { for (var curNode = this.__focusedElement; curNode.tagName != "SPAN" && curNode != document.body; curNode = curNode.parentNode) {} if (curNode != document.body) { this.__outlinedElement = curNode; } } else { this.__outlinedElement = this.__focusedElement; } if (this.__outlinedElement) { // see comments on top of this.__previousOutline to uderstand the reason for this if statement if (ariaCoreBrowser.isIE8) { this.__previousStyle = this.__outlinedElement.style.cssText;// aria.utils.Dom.getStyle(this.__outlinedElement, // "outline"); } else { this.__previousStyle = (this.__outlinedElement.style.outline) ? this.__outlinedElement.style.outline : ""; } // finally ste the outline property in inline style attribute this.__outlinedElement.style.outline = this.__style; } } }
javascript
{ "resource": "" }
q56793
train
function () { if (this.__style && this.__outlinedElement) { // restore the previous outline if (ariaCoreBrowser.isIE8) { this.__outlinedElement.style.cssText = this.__previousStyle; } else { this.__outlinedElement.style.outline = this.__previousStyle; } this.__outlinedElement = null; this.__previousStyle = null; } this.__focusedElement = null; }
javascript
{ "resource": "" }
q56794
train
function (newStyle) { var styleToApply = (newStyle) ? newStyle : ariaUtilsEnvironmentVisualFocus.getAppOutlineStyle(); this.__style = !ariaCoreBrowser.isIE7 ? styleToApply : null; this.__updateVisualFocus(); }
javascript
{ "resource": "" }
q56795
train
function (value) { var document = Aria.$window.document; if (value) { // add event listeners if AriaSkin is available // (required as it uses widgets) // TODO: investigate to plug with event delegation // when ready if (aria.widgets && aria.widgets.AriaSkin) { this._enabled = true; eventUtils.addListener(document, "contextmenu", { fn : this._onContextMenu, scope : this }); if (ariaCoreBrowser.isSafari) { // PTR 04547842: Safari does not support the // ctrlKey property on contextmenu event // register the mouseup event to get this // information eventUtils.addListener(document, "mouseup", { fn : this._onSafariMouseUp, scope : this }); } } } else { this._enabled = false; // remove event listeners eventUtils.removeListener(document, "contextmenu", { fn : this._onContextMenu }); if (ariaCoreBrowser.isSafari) { eventUtils.removeListener(document, "mouseup", { fn : this._onSafariMouseUp }); } } }
javascript
{ "resource": "" }
q56796
train
function (event) { if (!this._enabled) { return; } event = new ariaDomEvent(event); if (ariaCoreBrowser.isSafari) { event.ctrlKey = this._safariCtrlKey; } // ctrl right click only if (event.ctrlKey) { // stop default behaviour, like opening real // contextual menu event.stopPropagation(); event.preventDefault(); var target = event.target; this.__callContextualMenu(target, event.clientX, event.clientY); event.$dispose(); return false; } event.$dispose(); }
javascript
{ "resource": "" }
q56797
train
function (target, position) { // look for existing Contextual menu if (this._popup) { aria.tools.contextual.ContextualMenu.close(); } // first check the position else get positon from dom // element var domPosition = {}; if (!position) { if (!target.$TemplateCtxt) { domPosition = domUtils.getGeometry(target); } else { domPosition = { x : 0, y : 0 }; } } else { domPosition = position; } // look for template context if (target.$TemplateCtxt) { this._notifyFound(target, domPosition.x, domPosition.y); return; } // Internal call to initiate the notify this.__callContextualMenu(target, domPosition.x, domPosition.y); return false; }
javascript
{ "resource": "" }
q56798
train
function (target, x, y) { // check for template context var previousTarget; // look for the first template var body = Aria.$window.document.body; while (target && target != body && !target.__template) { previousTarget = target; target = target.parentNode; } // check for dom position if (target == body && previousTarget) { // prevousTarget might be a popup // first check whether the PopupManager is loaded: if (aria.popups && aria.popups.PopupManager) { // then look for the popup: var popup = aria.popups.PopupManager.getPopupFromDom(previousTarget); if (popup && popup.section && popup.section.tplCtxt) { // a popup was found this._notifyFound(popup.section.tplCtxt, x, y); } } } else if (target && target != body) { this._notifyFound(contextManager.getFromDom(target.parentNode), x, y); } }
javascript
{ "resource": "" }
q56799
train
function (templateCtxt, xpos, ypos) { // bridge is open -> inspector will handle this as well var bridge = aria.tools.ToolsBridge; if (bridge && bridge.isOpen) { bridge.$raiseEvent({ name : "forwardEvent", event : { name : "ContextualTargetFound", templateCtxt : templateCtxt } }); } if (this._popup) { return; } var popup = new ariaPopupsPopup(); this._popup = popup; popup.$on({ "onAfterClose" : this._afterClose, scope : this }); // create a section on the founded template context var section = templateCtxt.createSection({ fn : function (out) { var tplWidget = new ariaWidgetsTemplate({ defaultTemplate : this._appEnvCfg.template, moduleCtrl : { classpath : this._appEnvCfg.moduleCtrl, initArgs : { templateCtxt : templateCtxt.$interface("aria.templates.ITemplateCtxt"), driver : this.$interface("aria.tools.contextual.IContextualMenu") } } }, templateCtxt, "NOLINE"); out.registerBehavior(tplWidget); tplWidget.writeMarkup(out); }, scope : this }); popup.open({ section : section, absolutePosition : { top : ypos, left : xpos }, modal : true, maskCssClass : "xDialogMask" /* uses the css class from the AriaSkin */, preferredPositions : [{ reference : "bottom left", popup : "top left" }, { reference : "bottom left", popup : "top right" }], offset : { top : 0, left : 0 }, closeOnMouseClick : true, closeOnMouseScroll : true }); this.targetTemplateCtxt = templateCtxt; }
javascript
{ "resource": "" }