repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
ariatemplates/ariatemplates
src/aria/popups/PopupManager.js
function (popup) { var curZIndex = popup.getZIndex(); var newBaseZIndex = this.currentZIndex; if (curZIndex === newBaseZIndex) { // already top most, nothing to do in any case! return; } // gets all popups supposed to be in front of this one, including this one var openedPopups = this.openedPopups; var popupsToKeepInFront = []; var i, l; for (i = openedPopups.length - 1; i >= 0; i--) { var curPopup = openedPopups[i]; if (curPopup === popup || curPopup.conf.zIndexKeepOpenOrder) { popupsToKeepInFront.unshift(curPopup); if (curPopup.getZIndex() === newBaseZIndex) { newBaseZIndex -= 10; } if (curPopup === popup) { break; } } } if (i < 0 || newBaseZIndex + 10 === curZIndex) { // either the popup is not in openedPopups (i < 0) // or it is already correctly positioned (newBaseZIndex + 10 === curZIndex) return; } var eventObject = { name : "beforeBringingPopupsToFront", popups : popupsToKeepInFront, cancel : false }; this.$raiseEvent(eventObject); if (eventObject.cancel) { return; } this.currentZIndex = newBaseZIndex; for (i = 0, l = popupsToKeepInFront.length; i < l; i++) { var curPopup = popupsToKeepInFront[i]; curPopup.setZIndex(this.getZIndexForPopup(curPopup)); } }
javascript
function (popup) { var curZIndex = popup.getZIndex(); var newBaseZIndex = this.currentZIndex; if (curZIndex === newBaseZIndex) { // already top most, nothing to do in any case! return; } // gets all popups supposed to be in front of this one, including this one var openedPopups = this.openedPopups; var popupsToKeepInFront = []; var i, l; for (i = openedPopups.length - 1; i >= 0; i--) { var curPopup = openedPopups[i]; if (curPopup === popup || curPopup.conf.zIndexKeepOpenOrder) { popupsToKeepInFront.unshift(curPopup); if (curPopup.getZIndex() === newBaseZIndex) { newBaseZIndex -= 10; } if (curPopup === popup) { break; } } } if (i < 0 || newBaseZIndex + 10 === curZIndex) { // either the popup is not in openedPopups (i < 0) // or it is already correctly positioned (newBaseZIndex + 10 === curZIndex) return; } var eventObject = { name : "beforeBringingPopupsToFront", popups : popupsToKeepInFront, cancel : false }; this.$raiseEvent(eventObject); if (eventObject.cancel) { return; } this.currentZIndex = newBaseZIndex; for (i = 0, l = popupsToKeepInFront.length; i < l; i++) { var curPopup = popupsToKeepInFront[i]; curPopup.setZIndex(this.getZIndexForPopup(curPopup)); } }
[ "function", "(", "popup", ")", "{", "var", "curZIndex", "=", "popup", ".", "getZIndex", "(", ")", ";", "var", "newBaseZIndex", "=", "this", ".", "currentZIndex", ";", "if", "(", "curZIndex", "===", "newBaseZIndex", ")", "{", "return", ";", "}", "var", "openedPopups", "=", "this", ".", "openedPopups", ";", "var", "popupsToKeepInFront", "=", "[", "]", ";", "var", "i", ",", "l", ";", "for", "(", "i", "=", "openedPopups", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "var", "curPopup", "=", "openedPopups", "[", "i", "]", ";", "if", "(", "curPopup", "===", "popup", "||", "curPopup", ".", "conf", ".", "zIndexKeepOpenOrder", ")", "{", "popupsToKeepInFront", ".", "unshift", "(", "curPopup", ")", ";", "if", "(", "curPopup", ".", "getZIndex", "(", ")", "===", "newBaseZIndex", ")", "{", "newBaseZIndex", "-=", "10", ";", "}", "if", "(", "curPopup", "===", "popup", ")", "{", "break", ";", "}", "}", "}", "if", "(", "i", "<", "0", "||", "newBaseZIndex", "+", "10", "===", "curZIndex", ")", "{", "return", ";", "}", "var", "eventObject", "=", "{", "name", ":", "\"beforeBringingPopupsToFront\"", ",", "popups", ":", "popupsToKeepInFront", ",", "cancel", ":", "false", "}", ";", "this", ".", "$raiseEvent", "(", "eventObject", ")", ";", "if", "(", "eventObject", ".", "cancel", ")", "{", "return", ";", "}", "this", ".", "currentZIndex", "=", "newBaseZIndex", ";", "for", "(", "i", "=", "0", ",", "l", "=", "popupsToKeepInFront", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "var", "curPopup", "=", "popupsToKeepInFront", "[", "i", "]", ";", "curPopup", ".", "setZIndex", "(", "this", ".", "getZIndexForPopup", "(", "curPopup", ")", ")", ";", "}", "}" ]
Bring the given popup to the front, changing its zIndex, if it is necessary. @param {aria.popups.Popup} popup popup whose zIndex is to be changed
[ "Bring", "the", "given", "popup", "to", "the", "front", "changing", "its", "zIndex", "if", "it", "is", "necessary", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L445-L487
train
ariatemplates/ariatemplates
src/aria/popups/PopupManager.js
function (event) { var domEvent = /** @type aria.DomEvent */ new ariaDomEvent(event), target = /** @type HTMLElement */ domEvent.target; if (this.openedPopups.length === 0) { domEvent.$dispose(); return; } // restrict this to the popup on the top var popup = /** @type aria.popups.Popup */ this.openedPopups[this.openedPopups.length - 1]; var ignoreClick = false; for (var j = 0, length = popup._ignoreClicksOn.length; j < length; j++) { if (utilsDom.isAncestor(target, popup._ignoreClicksOn[j])) { ignoreClick = true; break; } } if (!(ignoreClick || utilsDom.isAncestor(target, popup.getDomElement()))) { popup.closeOnMouseClick(domEvent); } var topPopup = this.findParentPopup(target); if (topPopup) { this.bringToFront(topPopup); } domEvent.$dispose(); }
javascript
function (event) { var domEvent = /** @type aria.DomEvent */ new ariaDomEvent(event), target = /** @type HTMLElement */ domEvent.target; if (this.openedPopups.length === 0) { domEvent.$dispose(); return; } // restrict this to the popup on the top var popup = /** @type aria.popups.Popup */ this.openedPopups[this.openedPopups.length - 1]; var ignoreClick = false; for (var j = 0, length = popup._ignoreClicksOn.length; j < length; j++) { if (utilsDom.isAncestor(target, popup._ignoreClicksOn[j])) { ignoreClick = true; break; } } if (!(ignoreClick || utilsDom.isAncestor(target, popup.getDomElement()))) { popup.closeOnMouseClick(domEvent); } var topPopup = this.findParentPopup(target); if (topPopup) { this.bringToFront(topPopup); } domEvent.$dispose(); }
[ "function", "(", "event", ")", "{", "var", "domEvent", "=", "new", "ariaDomEvent", "(", "event", ")", ",", "target", "=", "domEvent", ".", "target", ";", "if", "(", "this", ".", "openedPopups", ".", "length", "===", "0", ")", "{", "domEvent", ".", "$dispose", "(", ")", ";", "return", ";", "}", "var", "popup", "=", "this", ".", "openedPopups", "[", "this", ".", "openedPopups", ".", "length", "-", "1", "]", ";", "var", "ignoreClick", "=", "false", ";", "for", "(", "var", "j", "=", "0", ",", "length", "=", "popup", ".", "_ignoreClicksOn", ".", "length", ";", "j", "<", "length", ";", "j", "++", ")", "{", "if", "(", "utilsDom", ".", "isAncestor", "(", "target", ",", "popup", ".", "_ignoreClicksOn", "[", "j", "]", ")", ")", "{", "ignoreClick", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "(", "ignoreClick", "||", "utilsDom", ".", "isAncestor", "(", "target", ",", "popup", ".", "getDomElement", "(", ")", ")", ")", ")", "{", "popup", ".", "closeOnMouseClick", "(", "domEvent", ")", ";", "}", "var", "topPopup", "=", "this", ".", "findParentPopup", "(", "target", ")", ";", "if", "(", "topPopup", ")", "{", "this", ".", "bringToFront", "(", "topPopup", ")", ";", "}", "domEvent", ".", "$dispose", "(", ")", ";", "}" ]
Callback when the user clicks on the document @param {Object} event The DOM click event triggering the callback
[ "Callback", "when", "the", "user", "clicks", "on", "the", "document" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L493-L525
train
ariatemplates/ariatemplates
src/aria/popups/PopupManager.js
function (event) { var domEvent = /** @type aria.DomEvent */ new ariaDomEvent(event); var fromTarget = /** @type HTMLElement */ domEvent.target; var toTarget = /** @type HTMLElement */ domEvent.relatedTarget; for (var i = this.openedPopups.length - 1; i >= 0; i--) { var popup = /** @type aria.popups.Popup */ this.openedPopups[i]; if (!utilsDom.isAncestor(toTarget, popup.getDomElement()) && utilsDom.isAncestor(fromTarget, popup.getDomElement())) { popup.closeOnMouseOut(domEvent); } } domEvent.$dispose(); }
javascript
function (event) { var domEvent = /** @type aria.DomEvent */ new ariaDomEvent(event); var fromTarget = /** @type HTMLElement */ domEvent.target; var toTarget = /** @type HTMLElement */ domEvent.relatedTarget; for (var i = this.openedPopups.length - 1; i >= 0; i--) { var popup = /** @type aria.popups.Popup */ this.openedPopups[i]; if (!utilsDom.isAncestor(toTarget, popup.getDomElement()) && utilsDom.isAncestor(fromTarget, popup.getDomElement())) { popup.closeOnMouseOut(domEvent); } } domEvent.$dispose(); }
[ "function", "(", "event", ")", "{", "var", "domEvent", "=", "new", "ariaDomEvent", "(", "event", ")", ";", "var", "fromTarget", "=", "domEvent", ".", "target", ";", "var", "toTarget", "=", "domEvent", ".", "relatedTarget", ";", "for", "(", "var", "i", "=", "this", ".", "openedPopups", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "var", "popup", "=", "this", ".", "openedPopups", "[", "i", "]", ";", "if", "(", "!", "utilsDom", ".", "isAncestor", "(", "toTarget", ",", "popup", ".", "getDomElement", "(", ")", ")", "&&", "utilsDom", ".", "isAncestor", "(", "fromTarget", ",", "popup", ".", "getDomElement", "(", ")", ")", ")", "{", "popup", ".", "closeOnMouseOut", "(", "domEvent", ")", ";", "}", "}", "domEvent", ".", "$dispose", "(", ")", ";", "}" ]
Callback when the mouse move on the document. This is required to close some popups. @param {Object} event
[ "Callback", "when", "the", "mouse", "move", "on", "the", "document", ".", "This", "is", "required", "to", "close", "some", "popups", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L531-L547
train
ariatemplates/ariatemplates
src/aria/popups/PopupManager.js
function (event) { var domEvent = /** @type aria.DomEvent */ new ariaDomEvent(event); // Retrieve the dom target var target = /** @type HTMLElement */ domEvent.target; // Close first popup on the stack that can be closed for (var i = this.openedPopups.length - 1; i >= 0; i--) { var popup = /** @type aria.popups.Popup */ this.openedPopups[i]; if (!utilsDom.isAncestor(target, popup.getDomElement())) { if (ariaCoreBrowser.isFirefox) { // There's a strange bug in FF when wheelmouse'ing quickly raises an event which target is HTML instead of the popup if (utilsDom.isAncestor(this._document.elementFromPoint(domEvent.clientX, domEvent.clientY), popup.getDomElement())) continue; } var closed = popup.closeOnMouseScroll(domEvent); if (closed) { break; } } } domEvent.$dispose(); }
javascript
function (event) { var domEvent = /** @type aria.DomEvent */ new ariaDomEvent(event); // Retrieve the dom target var target = /** @type HTMLElement */ domEvent.target; // Close first popup on the stack that can be closed for (var i = this.openedPopups.length - 1; i >= 0; i--) { var popup = /** @type aria.popups.Popup */ this.openedPopups[i]; if (!utilsDom.isAncestor(target, popup.getDomElement())) { if (ariaCoreBrowser.isFirefox) { // There's a strange bug in FF when wheelmouse'ing quickly raises an event which target is HTML instead of the popup if (utilsDom.isAncestor(this._document.elementFromPoint(domEvent.clientX, domEvent.clientY), popup.getDomElement())) continue; } var closed = popup.closeOnMouseScroll(domEvent); if (closed) { break; } } } domEvent.$dispose(); }
[ "function", "(", "event", ")", "{", "var", "domEvent", "=", "new", "ariaDomEvent", "(", "event", ")", ";", "var", "target", "=", "domEvent", ".", "target", ";", "for", "(", "var", "i", "=", "this", ".", "openedPopups", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "var", "popup", "=", "this", ".", "openedPopups", "[", "i", "]", ";", "if", "(", "!", "utilsDom", ".", "isAncestor", "(", "target", ",", "popup", ".", "getDomElement", "(", ")", ")", ")", "{", "if", "(", "ariaCoreBrowser", ".", "isFirefox", ")", "{", "if", "(", "utilsDom", ".", "isAncestor", "(", "this", ".", "_document", ".", "elementFromPoint", "(", "domEvent", ".", "clientX", ",", "domEvent", ".", "clientY", ")", ",", "popup", ".", "getDomElement", "(", ")", ")", ")", "continue", ";", "}", "var", "closed", "=", "popup", ".", "closeOnMouseScroll", "(", "domEvent", ")", ";", "if", "(", "closed", ")", "{", "break", ";", "}", "}", "}", "domEvent", ".", "$dispose", "(", ")", ";", "}" ]
Callback for mouse scroll. This is required to close some popups. @param {Object} event
[ "Callback", "for", "mouse", "scroll", ".", "This", "is", "required", "to", "close", "some", "popups", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L553-L581
train
ariatemplates/ariatemplates
src/aria/popups/PopupManager.js
function (popup) { if (utilsArray.isEmpty(this.openedPopups)) { this.connectEvents(); } if (popup.modalMaskDomElement) { if (this.modalPopups === 0) { this.connectModalEvents(); this.$raiseEvent("modalPopupPresent"); } this.modalPopups += 1; } this.openedPopups.push(popup); this.$raiseEvent({ name : "popupOpen", popup : popup }); if (!ariaCoreBrowser.isIE7) { // The navigation elements inserted by ensureElements make the following tests fail on IE 7: // - test.aria.widgets.wai.popup.dialog.modal.FirstTest // - test.aria.widgets.wai.popup.dialog.modal.FourthTest // Those tests are blocked in _testFocusRestoration while waiting for the opening element to // be focused again. It is not obvious why adding the navigation elements prevents the opening // element from being correctly focused again when the dialog is closed... just an IE 7 bug! // The issue seems not to happen if we do not remove the navigation elements from the DOM when // the dialog is closed. However, instead of keeping those elements in the DOM a little longer // (with a non-deterministic setTimeout), we simply avoid adding those elements on IE 7: this._viewportNavigationInterceptor.ensureElements(); } }
javascript
function (popup) { if (utilsArray.isEmpty(this.openedPopups)) { this.connectEvents(); } if (popup.modalMaskDomElement) { if (this.modalPopups === 0) { this.connectModalEvents(); this.$raiseEvent("modalPopupPresent"); } this.modalPopups += 1; } this.openedPopups.push(popup); this.$raiseEvent({ name : "popupOpen", popup : popup }); if (!ariaCoreBrowser.isIE7) { // The navigation elements inserted by ensureElements make the following tests fail on IE 7: // - test.aria.widgets.wai.popup.dialog.modal.FirstTest // - test.aria.widgets.wai.popup.dialog.modal.FourthTest // Those tests are blocked in _testFocusRestoration while waiting for the opening element to // be focused again. It is not obvious why adding the navigation elements prevents the opening // element from being correctly focused again when the dialog is closed... just an IE 7 bug! // The issue seems not to happen if we do not remove the navigation elements from the DOM when // the dialog is closed. However, instead of keeping those elements in the DOM a little longer // (with a non-deterministic setTimeout), we simply avoid adding those elements on IE 7: this._viewportNavigationInterceptor.ensureElements(); } }
[ "function", "(", "popup", ")", "{", "if", "(", "utilsArray", ".", "isEmpty", "(", "this", ".", "openedPopups", ")", ")", "{", "this", ".", "connectEvents", "(", ")", ";", "}", "if", "(", "popup", ".", "modalMaskDomElement", ")", "{", "if", "(", "this", ".", "modalPopups", "===", "0", ")", "{", "this", ".", "connectModalEvents", "(", ")", ";", "this", ".", "$raiseEvent", "(", "\"modalPopupPresent\"", ")", ";", "}", "this", ".", "modalPopups", "+=", "1", ";", "}", "this", ".", "openedPopups", ".", "push", "(", "popup", ")", ";", "this", ".", "$raiseEvent", "(", "{", "name", ":", "\"popupOpen\"", ",", "popup", ":", "popup", "}", ")", ";", "if", "(", "!", "ariaCoreBrowser", ".", "isIE7", ")", "{", "this", ".", "_viewportNavigationInterceptor", ".", "ensureElements", "(", ")", ";", "}", "}" ]
Manager handler when a popup is open. Register the popup as opened, register global events if needed. @param {aria.popups.Popup} popup
[ "Manager", "handler", "when", "a", "popup", "is", "open", ".", "Register", "the", "popup", "as", "opened", "register", "global", "events", "if", "needed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L587-L617
train
ariatemplates/ariatemplates
src/aria/popups/PopupManager.js
function (popup) { var openedPopups = this.openedPopups; utilsArray.remove(openedPopups, popup); if (popup.modalMaskDomElement) { this.modalPopups -= 1; if (this.modalPopups === 0) { this.disconnectModalEvents(); this.$raiseEvent("modalPopupAbsent"); this._viewportNavigationInterceptor.destroyElements(); } } if (utilsArray.isEmpty(openedPopups)) { this.disconnectEvents(); } var curZIndex = popup.getZIndex(); if (curZIndex === this.currentZIndex) { this.currentZIndex -= 10; } this.$raiseEvent({ name : "popupClose", popup : popup }); }
javascript
function (popup) { var openedPopups = this.openedPopups; utilsArray.remove(openedPopups, popup); if (popup.modalMaskDomElement) { this.modalPopups -= 1; if (this.modalPopups === 0) { this.disconnectModalEvents(); this.$raiseEvent("modalPopupAbsent"); this._viewportNavigationInterceptor.destroyElements(); } } if (utilsArray.isEmpty(openedPopups)) { this.disconnectEvents(); } var curZIndex = popup.getZIndex(); if (curZIndex === this.currentZIndex) { this.currentZIndex -= 10; } this.$raiseEvent({ name : "popupClose", popup : popup }); }
[ "function", "(", "popup", ")", "{", "var", "openedPopups", "=", "this", ".", "openedPopups", ";", "utilsArray", ".", "remove", "(", "openedPopups", ",", "popup", ")", ";", "if", "(", "popup", ".", "modalMaskDomElement", ")", "{", "this", ".", "modalPopups", "-=", "1", ";", "if", "(", "this", ".", "modalPopups", "===", "0", ")", "{", "this", ".", "disconnectModalEvents", "(", ")", ";", "this", ".", "$raiseEvent", "(", "\"modalPopupAbsent\"", ")", ";", "this", ".", "_viewportNavigationInterceptor", ".", "destroyElements", "(", ")", ";", "}", "}", "if", "(", "utilsArray", ".", "isEmpty", "(", "openedPopups", ")", ")", "{", "this", ".", "disconnectEvents", "(", ")", ";", "}", "var", "curZIndex", "=", "popup", ".", "getZIndex", "(", ")", ";", "if", "(", "curZIndex", "===", "this", ".", "currentZIndex", ")", "{", "this", ".", "currentZIndex", "-=", "10", ";", "}", "this", ".", "$raiseEvent", "(", "{", "name", ":", "\"popupClose\"", ",", "popup", ":", "popup", "}", ")", ";", "}" ]
Manager handler when a popup is closed. Unregister the popup as opened, unregister global events if needed. @param {aria.popups.Popup} popup
[ "Manager", "handler", "when", "a", "popup", "is", "closed", ".", "Unregister", "the", "popup", "as", "opened", "unregister", "global", "events", "if", "needed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L623-L646
train
ariatemplates/ariatemplates
src/aria/popups/PopupManager.js
function (popup) { if (utilsArray.contains(this.openedPopups, popup)) { utilsArray.remove(this.openedPopups, popup); } if (utilsArray.contains(this.popups, popup)) { utilsArray.remove(this.popups, popup); } if (utilsArray.isEmpty(this.openedPopups)) { this.currentZIndex = this.baseZIndex; } }
javascript
function (popup) { if (utilsArray.contains(this.openedPopups, popup)) { utilsArray.remove(this.openedPopups, popup); } if (utilsArray.contains(this.popups, popup)) { utilsArray.remove(this.popups, popup); } if (utilsArray.isEmpty(this.openedPopups)) { this.currentZIndex = this.baseZIndex; } }
[ "function", "(", "popup", ")", "{", "if", "(", "utilsArray", ".", "contains", "(", "this", ".", "openedPopups", ",", "popup", ")", ")", "{", "utilsArray", ".", "remove", "(", "this", ".", "openedPopups", ",", "popup", ")", ";", "}", "if", "(", "utilsArray", ".", "contains", "(", "this", ".", "popups", ",", "popup", ")", ")", "{", "utilsArray", ".", "remove", "(", "this", ".", "popups", ",", "popup", ")", ";", "}", "if", "(", "utilsArray", ".", "isEmpty", "(", "this", ".", "openedPopups", ")", ")", "{", "this", ".", "currentZIndex", "=", "this", ".", "baseZIndex", ";", "}", "}" ]
Unregister the popup in the manager. @param {aria.popups.Popup} popup
[ "Unregister", "the", "popup", "in", "the", "manager", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L674-L684
train
ariatemplates/ariatemplates
src/aria/popups/PopupManager.js
function (domElement) { var popups = this.popups; for (var i = 0, l = popups.length; i < l; i++) { var curPopup = popups[i]; if (curPopup.domElement == domElement) { return curPopup; } } return null; }
javascript
function (domElement) { var popups = this.popups; for (var i = 0, l = popups.length; i < l; i++) { var curPopup = popups[i]; if (curPopup.domElement == domElement) { return curPopup; } } return null; }
[ "function", "(", "domElement", ")", "{", "var", "popups", "=", "this", ".", "popups", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "popups", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "var", "curPopup", "=", "popups", "[", "i", "]", ";", "if", "(", "curPopup", ".", "domElement", "==", "domElement", ")", "{", "return", "curPopup", ";", "}", "}", "return", "null", ";", "}" ]
Get the popup object from its DOM element. @param {HTMLElement} domElement DOM element of the popup @return {aria.popups.Popup}
[ "Get", "the", "popup", "object", "from", "its", "DOM", "element", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/PopupManager.js#L691-L700
train
ariatemplates/ariatemplates
src/aria/widgets/calendar/RangeCalendar.js
function (evt) { if (this._inOnBoundPropertyChange) { return; } if (evt.name == "update") { if (evt.properties["startDate"]) { this.setProperty("startDate", this._subTplData.settings.startDate); } } else if (evt.name == "dateClick") { this.evalCallback(this._cfg.onclick, evt); if (!evt.cancelDefault) { this.dateSelect(evt.date); } } else if (evt.name == "dateMouseOver") { this.evalCallback(this._cfg.onmouseover, evt); } else if (evt.name == "dateMouseOut") { this.evalCallback(this._cfg.onmouseout, evt); } }
javascript
function (evt) { if (this._inOnBoundPropertyChange) { return; } if (evt.name == "update") { if (evt.properties["startDate"]) { this.setProperty("startDate", this._subTplData.settings.startDate); } } else if (evt.name == "dateClick") { this.evalCallback(this._cfg.onclick, evt); if (!evt.cancelDefault) { this.dateSelect(evt.date); } } else if (evt.name == "dateMouseOver") { this.evalCallback(this._cfg.onmouseover, evt); } else if (evt.name == "dateMouseOut") { this.evalCallback(this._cfg.onmouseout, evt); } }
[ "function", "(", "evt", ")", "{", "if", "(", "this", ".", "_inOnBoundPropertyChange", ")", "{", "return", ";", "}", "if", "(", "evt", ".", "name", "==", "\"update\"", ")", "{", "if", "(", "evt", ".", "properties", "[", "\"startDate\"", "]", ")", "{", "this", ".", "setProperty", "(", "\"startDate\"", ",", "this", ".", "_subTplData", ".", "settings", ".", "startDate", ")", ";", "}", "}", "else", "if", "(", "evt", ".", "name", "==", "\"dateClick\"", ")", "{", "this", ".", "evalCallback", "(", "this", ".", "_cfg", ".", "onclick", ",", "evt", ")", ";", "if", "(", "!", "evt", ".", "cancelDefault", ")", "{", "this", ".", "dateSelect", "(", "evt", ".", "date", ")", ";", "}", "}", "else", "if", "(", "evt", ".", "name", "==", "\"dateMouseOver\"", ")", "{", "this", ".", "evalCallback", "(", "this", ".", "_cfg", ".", "onmouseover", ",", "evt", ")", ";", "}", "else", "if", "(", "evt", ".", "name", "==", "\"dateMouseOut\"", ")", "{", "this", ".", "evalCallback", "(", "this", ".", "_cfg", ".", "onmouseout", ",", "evt", ")", ";", "}", "}" ]
React to the events coming from the module controller. @param {Object} evt Module event
[ "React", "to", "the", "events", "coming", "from", "the", "module", "controller", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/calendar/RangeCalendar.js#L86-L104
train
ariatemplates/ariatemplates
src/aria/widgets/calendar/RangeCalendar.js
function () { var res = []; var cfg = this._cfg; if (cfg.fromDate || cfg.toDate) { var cssPrefix = "x" + this._skinnableClass + "_" + this._cfg.sclass; res.push({ fromDate : cfg.fromDate || cfg.toDate, toDate : cfg.toDate || cfg.fromDate, classes : { from : cssPrefix + "_selected_from", to : cssPrefix + "_selected_to", fromTo : cssPrefix + "_selected_from_to", sameFromTo : cssPrefix + "_selected_same_from_to" } }); } var cfgRanges = cfg.ranges; if (cfgRanges) { res = res.concat(cfgRanges); } return res; }
javascript
function () { var res = []; var cfg = this._cfg; if (cfg.fromDate || cfg.toDate) { var cssPrefix = "x" + this._skinnableClass + "_" + this._cfg.sclass; res.push({ fromDate : cfg.fromDate || cfg.toDate, toDate : cfg.toDate || cfg.fromDate, classes : { from : cssPrefix + "_selected_from", to : cssPrefix + "_selected_to", fromTo : cssPrefix + "_selected_from_to", sameFromTo : cssPrefix + "_selected_same_from_to" } }); } var cfgRanges = cfg.ranges; if (cfgRanges) { res = res.concat(cfgRanges); } return res; }
[ "function", "(", ")", "{", "var", "res", "=", "[", "]", ";", "var", "cfg", "=", "this", ".", "_cfg", ";", "if", "(", "cfg", ".", "fromDate", "||", "cfg", ".", "toDate", ")", "{", "var", "cssPrefix", "=", "\"x\"", "+", "this", ".", "_skinnableClass", "+", "\"_\"", "+", "this", ".", "_cfg", ".", "sclass", ";", "res", ".", "push", "(", "{", "fromDate", ":", "cfg", ".", "fromDate", "||", "cfg", ".", "toDate", ",", "toDate", ":", "cfg", ".", "toDate", "||", "cfg", ".", "fromDate", ",", "classes", ":", "{", "from", ":", "cssPrefix", "+", "\"_selected_from\"", ",", "to", ":", "cssPrefix", "+", "\"_selected_to\"", ",", "fromTo", ":", "cssPrefix", "+", "\"_selected_from_to\"", ",", "sameFromTo", ":", "cssPrefix", "+", "\"_selected_same_from_to\"", "}", "}", ")", ";", "}", "var", "cfgRanges", "=", "cfg", ".", "ranges", ";", "if", "(", "cfgRanges", ")", "{", "res", "=", "res", ".", "concat", "(", "cfgRanges", ")", ";", "}", "return", "res", ";", "}" ]
Returns the array of ranges to be passed to the calendar controller. @return {Array}
[ "Returns", "the", "array", "of", "ranges", "to", "be", "passed", "to", "the", "calendar", "controller", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/calendar/RangeCalendar.js#L110-L131
train
ariatemplates/ariatemplates
src/aria/widgets/calendar/RangeCalendar.js
function (propertyName, newValue, oldValue) { this._inOnBoundPropertyChange = true; try { if (propertyName == "startDate") { this._subTplModuleCtrl.navigate({}, { date : newValue }); } else if (propertyName == "fromDate" || propertyName == "toDate" || propertyName == "ranges") { this._subTplModuleCtrl.setRanges(this._getRanges()); } } finally { this._inOnBoundPropertyChange = false; } }
javascript
function (propertyName, newValue, oldValue) { this._inOnBoundPropertyChange = true; try { if (propertyName == "startDate") { this._subTplModuleCtrl.navigate({}, { date : newValue }); } else if (propertyName == "fromDate" || propertyName == "toDate" || propertyName == "ranges") { this._subTplModuleCtrl.setRanges(this._getRanges()); } } finally { this._inOnBoundPropertyChange = false; } }
[ "function", "(", "propertyName", ",", "newValue", ",", "oldValue", ")", "{", "this", ".", "_inOnBoundPropertyChange", "=", "true", ";", "try", "{", "if", "(", "propertyName", "==", "\"startDate\"", ")", "{", "this", ".", "_subTplModuleCtrl", ".", "navigate", "(", "{", "}", ",", "{", "date", ":", "newValue", "}", ")", ";", "}", "else", "if", "(", "propertyName", "==", "\"fromDate\"", "||", "propertyName", "==", "\"toDate\"", "||", "propertyName", "==", "\"ranges\"", ")", "{", "this", ".", "_subTplModuleCtrl", ".", "setRanges", "(", "this", ".", "_getRanges", "(", ")", ")", ";", "}", "}", "finally", "{", "this", ".", "_inOnBoundPropertyChange", "=", "false", ";", "}", "}" ]
Internal method called when one of the model property that the widget is bound to has changed. @protected @param {String} propertyName the property name @param {Object} newValue the new value. If transformation is used, refers to widget value and not data model value. @param {Object} oldValue the old property value. If transformation is used, refers to widget value and not data model value.
[ "Internal", "method", "called", "when", "one", "of", "the", "model", "property", "that", "the", "widget", "is", "bound", "to", "has", "changed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/calendar/RangeCalendar.js#L142-L155
train
ariatemplates/ariatemplates
src/aria/widgets/calendar/RangeCalendar.js
function (domEvt) { var domElt = this.getDom(); if (this.sendKey(domEvt.charCode, domEvt.keyCode)) { domEvt.preventDefault(true); domElt.focus(); } }
javascript
function (domEvt) { var domElt = this.getDom(); if (this.sendKey(domEvt.charCode, domEvt.keyCode)) { domEvt.preventDefault(true); domElt.focus(); } }
[ "function", "(", "domEvt", ")", "{", "var", "domElt", "=", "this", ".", "getDom", "(", ")", ";", "if", "(", "this", ".", "sendKey", "(", "domEvt", ".", "charCode", ",", "domEvt", ".", "keyCode", ")", ")", "{", "domEvt", ".", "preventDefault", "(", "true", ")", ";", "domElt", ".", "focus", "(", ")", ";", "}", "}" ]
Keyboard support for the calendar. @protected @param {aria.DomEvent} domEvt Key down event
[ "Keyboard", "support", "for", "the", "calendar", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/calendar/RangeCalendar.js#L162-L168
train
ariatemplates/ariatemplates
src/aria/widgets/calendar/RangeCalendar.js
function () { this._plannedFocusUpdate = null; if (this._focusStyle == this._hasFocus) { // nothing to do! return; } var moduleCtrl = this._subTplModuleCtrl, dom = this.getDom(); if (moduleCtrl && dom && this._cfg.tabIndex != null && this._cfg.tabIndex >= 0) { var preventDefaultVisualAspect = moduleCtrl.notifyFocusChanged(this._hasFocus); if (!preventDefaultVisualAspect) { var domEltStyle = dom.style; var visualFocusStyle = (aria.utils.VisualFocus) ? aria.utils.VisualFocus.getStyle() : null; if (this._hasFocus) { if (ariaCoreBrowser.isIE7) { domEltStyle.border = "1px dotted black"; domEltStyle.padding = "0px"; } else { if (visualFocusStyle == null) { domEltStyle.outline = "1px dotted black"; } } } else { if (ariaCoreBrowser.isIE7) { domEltStyle.border = "0px"; domEltStyle.padding = "1px"; } else { if (visualFocusStyle == null) { domEltStyle.outline = "none"; } } } } if (this._hasFocus) { moduleCtrl.selectDay({ date : this._cfg.fromDate || this._cfg.toDate, ensureVisible : false }); } else { moduleCtrl.selectDay({ date : null }); } this._focusStyle = this._hasFocus; } }
javascript
function () { this._plannedFocusUpdate = null; if (this._focusStyle == this._hasFocus) { // nothing to do! return; } var moduleCtrl = this._subTplModuleCtrl, dom = this.getDom(); if (moduleCtrl && dom && this._cfg.tabIndex != null && this._cfg.tabIndex >= 0) { var preventDefaultVisualAspect = moduleCtrl.notifyFocusChanged(this._hasFocus); if (!preventDefaultVisualAspect) { var domEltStyle = dom.style; var visualFocusStyle = (aria.utils.VisualFocus) ? aria.utils.VisualFocus.getStyle() : null; if (this._hasFocus) { if (ariaCoreBrowser.isIE7) { domEltStyle.border = "1px dotted black"; domEltStyle.padding = "0px"; } else { if (visualFocusStyle == null) { domEltStyle.outline = "1px dotted black"; } } } else { if (ariaCoreBrowser.isIE7) { domEltStyle.border = "0px"; domEltStyle.padding = "1px"; } else { if (visualFocusStyle == null) { domEltStyle.outline = "none"; } } } } if (this._hasFocus) { moduleCtrl.selectDay({ date : this._cfg.fromDate || this._cfg.toDate, ensureVisible : false }); } else { moduleCtrl.selectDay({ date : null }); } this._focusStyle = this._hasFocus; } }
[ "function", "(", ")", "{", "this", ".", "_plannedFocusUpdate", "=", "null", ";", "if", "(", "this", ".", "_focusStyle", "==", "this", ".", "_hasFocus", ")", "{", "return", ";", "}", "var", "moduleCtrl", "=", "this", ".", "_subTplModuleCtrl", ",", "dom", "=", "this", ".", "getDom", "(", ")", ";", "if", "(", "moduleCtrl", "&&", "dom", "&&", "this", ".", "_cfg", ".", "tabIndex", "!=", "null", "&&", "this", ".", "_cfg", ".", "tabIndex", ">=", "0", ")", "{", "var", "preventDefaultVisualAspect", "=", "moduleCtrl", ".", "notifyFocusChanged", "(", "this", ".", "_hasFocus", ")", ";", "if", "(", "!", "preventDefaultVisualAspect", ")", "{", "var", "domEltStyle", "=", "dom", ".", "style", ";", "var", "visualFocusStyle", "=", "(", "aria", ".", "utils", ".", "VisualFocus", ")", "?", "aria", ".", "utils", ".", "VisualFocus", ".", "getStyle", "(", ")", ":", "null", ";", "if", "(", "this", ".", "_hasFocus", ")", "{", "if", "(", "ariaCoreBrowser", ".", "isIE7", ")", "{", "domEltStyle", ".", "border", "=", "\"1px dotted black\"", ";", "domEltStyle", ".", "padding", "=", "\"0px\"", ";", "}", "else", "{", "if", "(", "visualFocusStyle", "==", "null", ")", "{", "domEltStyle", ".", "outline", "=", "\"1px dotted black\"", ";", "}", "}", "}", "else", "{", "if", "(", "ariaCoreBrowser", ".", "isIE7", ")", "{", "domEltStyle", ".", "border", "=", "\"0px\"", ";", "domEltStyle", ".", "padding", "=", "\"1px\"", ";", "}", "else", "{", "if", "(", "visualFocusStyle", "==", "null", ")", "{", "domEltStyle", ".", "outline", "=", "\"none\"", ";", "}", "}", "}", "}", "if", "(", "this", ".", "_hasFocus", ")", "{", "moduleCtrl", ".", "selectDay", "(", "{", "date", ":", "this", ".", "_cfg", ".", "fromDate", "||", "this", ".", "_cfg", ".", "toDate", ",", "ensureVisible", ":", "false", "}", ")", ";", "}", "else", "{", "moduleCtrl", ".", "selectDay", "(", "{", "date", ":", "null", "}", ")", ";", "}", "this", ".", "_focusStyle", "=", "this", ".", "_hasFocus", ";", "}", "}" ]
Notify the calendar module controller of a change of focus. @protected
[ "Notify", "the", "calendar", "module", "controller", "of", "a", "change", "of", "focus", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/calendar/RangeCalendar.js#L217-L261
train
ariatemplates/ariatemplates
src/aria/widgets/calendar/RangeCalendar.js
function (charCode, keyCode) { var moduleCtrl = this._subTplModuleCtrl; if (moduleCtrl) { var value = this._subTplData.settings.value; if ((keyCode == 13 || keyCode == 32) && value) { // SPACE or ENTER -> call dateSelect this.dateSelect(value); return true; } else { return moduleCtrl.keyevent({ charCode : charCode, keyCode : keyCode }); } } else { return false; } }
javascript
function (charCode, keyCode) { var moduleCtrl = this._subTplModuleCtrl; if (moduleCtrl) { var value = this._subTplData.settings.value; if ((keyCode == 13 || keyCode == 32) && value) { // SPACE or ENTER -> call dateSelect this.dateSelect(value); return true; } else { return moduleCtrl.keyevent({ charCode : charCode, keyCode : keyCode }); } } else { return false; } }
[ "function", "(", "charCode", ",", "keyCode", ")", "{", "var", "moduleCtrl", "=", "this", ".", "_subTplModuleCtrl", ";", "if", "(", "moduleCtrl", ")", "{", "var", "value", "=", "this", ".", "_subTplData", ".", "settings", ".", "value", ";", "if", "(", "(", "keyCode", "==", "13", "||", "keyCode", "==", "32", ")", "&&", "value", ")", "{", "this", ".", "dateSelect", "(", "value", ")", ";", "return", "true", ";", "}", "else", "{", "return", "moduleCtrl", ".", "keyevent", "(", "{", "charCode", ":", "charCode", ",", "keyCode", ":", "keyCode", "}", ")", ";", "}", "}", "else", "{", "return", "false", ";", "}", "}" ]
Send a key to the calendar module controller @param {String} charCode Character code @param {String} keyCode Key code @return {Boolean} true if default action and key propagation should be canceled.
[ "Send", "a", "key", "to", "the", "calendar", "module", "controller" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/calendar/RangeCalendar.js#L269-L286
train
ariatemplates/ariatemplates
src/aria/storage/HTML5Storage.js
function (options, storage, throwIfMissing) { this.$AbstractStorage.constructor.call(this, options); /** * Type of html5 storage. E.g. localStorage, sessionStorage * @type String */ this.type = storage; /** * Keep a reference to the global storage object * @type Object */ this.storage = Aria.$window[storage]; /** * Event Callback for storage event happening on different windows * @type aria.core.CfgBeans:Callback */ this._browserEventCb = null; if (!this.storage && throwIfMissing !== false) { // This might have been created by AbstractStorage if (this._disposeSerializer && this.serializer) { this.serializer.$dispose(); } this.$logError(this.UNAVAILABLE, [this.type]); throw new Error(this.type); } }
javascript
function (options, storage, throwIfMissing) { this.$AbstractStorage.constructor.call(this, options); /** * Type of html5 storage. E.g. localStorage, sessionStorage * @type String */ this.type = storage; /** * Keep a reference to the global storage object * @type Object */ this.storage = Aria.$window[storage]; /** * Event Callback for storage event happening on different windows * @type aria.core.CfgBeans:Callback */ this._browserEventCb = null; if (!this.storage && throwIfMissing !== false) { // This might have been created by AbstractStorage if (this._disposeSerializer && this.serializer) { this.serializer.$dispose(); } this.$logError(this.UNAVAILABLE, [this.type]); throw new Error(this.type); } }
[ "function", "(", "options", ",", "storage", ",", "throwIfMissing", ")", "{", "this", ".", "$AbstractStorage", ".", "constructor", ".", "call", "(", "this", ",", "options", ")", ";", "this", ".", "type", "=", "storage", ";", "this", ".", "storage", "=", "Aria", ".", "$window", "[", "storage", "]", ";", "this", ".", "_browserEventCb", "=", "null", ";", "if", "(", "!", "this", ".", "storage", "&&", "throwIfMissing", "!==", "false", ")", "{", "if", "(", "this", ".", "_disposeSerializer", "&&", "this", ".", "serializer", ")", "{", "this", ".", "serializer", ".", "$dispose", "(", ")", ";", "}", "this", ".", "$logError", "(", "this", ".", "UNAVAILABLE", ",", "[", "this", ".", "type", "]", ")", ";", "throw", "new", "Error", "(", "this", ".", "type", ")", ";", "}", "}" ]
Create a generic instance of HTML5Storage @param {aria.storage.Beans:ConstructorArgs} options Constructor options @param {String} storage Type of storage: either localStorage or sessionStorage
[ "Create", "a", "generic", "instance", "of", "HTML5Storage" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/storage/HTML5Storage.js#L36-L66
train
ariatemplates/ariatemplates
src/aria/storage/HTML5Storage.js
function (event) { // In FF 3.6 this event is raised also inside the same window if (aria.storage.EventBus.stop) { return; } var isInteresting = this.namespace ? event.key.substring(0, this.namespace.length) === this.namespace : true; if (isInteresting) { var oldValue = event.oldValue, newValue = event.newValue; if (oldValue) { try { oldValue = this.serializer.parse(oldValue); } catch (e) {} } if (newValue) { try { newValue = this.serializer.parse(newValue); } catch (e) {} } this._onStorageEvent({ name : "change", key : event.key, oldValue : oldValue, newValue : newValue, url : event.url, namespace : this.namespace }); } }
javascript
function (event) { // In FF 3.6 this event is raised also inside the same window if (aria.storage.EventBus.stop) { return; } var isInteresting = this.namespace ? event.key.substring(0, this.namespace.length) === this.namespace : true; if (isInteresting) { var oldValue = event.oldValue, newValue = event.newValue; if (oldValue) { try { oldValue = this.serializer.parse(oldValue); } catch (e) {} } if (newValue) { try { newValue = this.serializer.parse(newValue); } catch (e) {} } this._onStorageEvent({ name : "change", key : event.key, oldValue : oldValue, newValue : newValue, url : event.url, namespace : this.namespace }); } }
[ "function", "(", "event", ")", "{", "if", "(", "aria", ".", "storage", ".", "EventBus", ".", "stop", ")", "{", "return", ";", "}", "var", "isInteresting", "=", "this", ".", "namespace", "?", "event", ".", "key", ".", "substring", "(", "0", ",", "this", ".", "namespace", ".", "length", ")", "===", "this", ".", "namespace", ":", "true", ";", "if", "(", "isInteresting", ")", "{", "var", "oldValue", "=", "event", ".", "oldValue", ",", "newValue", "=", "event", ".", "newValue", ";", "if", "(", "oldValue", ")", "{", "try", "{", "oldValue", "=", "this", ".", "serializer", ".", "parse", "(", "oldValue", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "}", "if", "(", "newValue", ")", "{", "try", "{", "newValue", "=", "this", ".", "serializer", ".", "parse", "(", "newValue", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "}", "this", ".", "_onStorageEvent", "(", "{", "name", ":", "\"change\"", ",", "key", ":", "event", ".", "key", ",", "oldValue", ":", "oldValue", ",", "newValue", ":", "newValue", ",", "url", ":", "event", ".", "url", ",", "namespace", ":", "this", ".", "namespace", "}", ")", ";", "}", "}" ]
React to storage event raised by the browser. We react only if this class does not have a namespace or if the key appears to be correctly namespaced. @param {HTMLEvent} event Event raised by the browser
[ "React", "to", "storage", "event", "raised", "by", "the", "browser", ".", "We", "react", "only", "if", "this", "class", "does", "not", "have", "a", "namespace", "or", "if", "the", "key", "appears", "to", "be", "correctly", "namespaced", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/storage/HTML5Storage.js#L115-L146
train
ariatemplates/ariatemplates
src/aria/storage/HTML5Storage.js
function () { if (!this.storage) { return; } var listeners = !!this._listeners; var registeredBrowserEvent = !!this._browserEventCb; if (listeners !== registeredBrowserEvent) { if (listeners) { this._browserEventCb = { fn : this._browserEvent, scope : this }; // listen to events raised by instances in a different window but the same storage location ariaUtilsEvent.addListener(Aria.$window, "storage", this._browserEventCb); } else { ariaUtilsEvent.removeListener(Aria.$window, "storage", this._browserEventCb); this._browserEventCb = null; } } }
javascript
function () { if (!this.storage) { return; } var listeners = !!this._listeners; var registeredBrowserEvent = !!this._browserEventCb; if (listeners !== registeredBrowserEvent) { if (listeners) { this._browserEventCb = { fn : this._browserEvent, scope : this }; // listen to events raised by instances in a different window but the same storage location ariaUtilsEvent.addListener(Aria.$window, "storage", this._browserEventCb); } else { ariaUtilsEvent.removeListener(Aria.$window, "storage", this._browserEventCb); this._browserEventCb = null; } } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "storage", ")", "{", "return", ";", "}", "var", "listeners", "=", "!", "!", "this", ".", "_listeners", ";", "var", "registeredBrowserEvent", "=", "!", "!", "this", ".", "_browserEventCb", ";", "if", "(", "listeners", "!==", "registeredBrowserEvent", ")", "{", "if", "(", "listeners", ")", "{", "this", ".", "_browserEventCb", "=", "{", "fn", ":", "this", ".", "_browserEvent", ",", "scope", ":", "this", "}", ";", "ariaUtilsEvent", ".", "addListener", "(", "Aria", ".", "$window", ",", "\"storage\"", ",", "this", ".", "_browserEventCb", ")", ";", "}", "else", "{", "ariaUtilsEvent", ".", "removeListener", "(", "Aria", ".", "$window", ",", "\"storage\"", ",", "this", ".", "_browserEventCb", ")", ";", "this", ".", "_browserEventCb", "=", "null", ";", "}", "}", "}" ]
Depending on whether there is any listener, registers or unregisters the browser storage event.
[ "Depending", "on", "whether", "there", "is", "any", "listener", "registers", "or", "unregisters", "the", "browser", "storage", "event", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/storage/HTML5Storage.js#L151-L172
train
ariatemplates/ariatemplates
src/aria/jsunit/Assert.js
function () { this.$Test._endTest.call(this); this.checkExpectedEventListEnd(); this.resetClassOverrides(); this.assertLogsEmpty(false, false); this._assertCount = 0; this._currentTestName = ''; this._isFinished = true; this.$raiseEvent({ name : "end", testObject : this, testClass : this.$classpath, nbrOfAsserts : this._totalAssertCount }); }
javascript
function () { this.$Test._endTest.call(this); this.checkExpectedEventListEnd(); this.resetClassOverrides(); this.assertLogsEmpty(false, false); this._assertCount = 0; this._currentTestName = ''; this._isFinished = true; this.$raiseEvent({ name : "end", testObject : this, testClass : this.$classpath, nbrOfAsserts : this._totalAssertCount }); }
[ "function", "(", ")", "{", "this", ".", "$Test", ".", "_endTest", ".", "call", "(", "this", ")", ";", "this", ".", "checkExpectedEventListEnd", "(", ")", ";", "this", ".", "resetClassOverrides", "(", ")", ";", "this", ".", "assertLogsEmpty", "(", "false", ",", "false", ")", ";", "this", ".", "_assertCount", "=", "0", ";", "this", ".", "_currentTestName", "=", "''", ";", "this", ".", "_isFinished", "=", "true", ";", "this", ".", "$raiseEvent", "(", "{", "name", ":", "\"end\"", ",", "testObject", ":", "this", ",", "testClass", ":", "this", ".", "$classpath", ",", "nbrOfAsserts", ":", "this", ".", "_totalAssertCount", "}", ")", ";", "}" ]
Reset the object and notify the end of the test to the listener @private
[ "Reset", "the", "object", "and", "notify", "the", "end", "of", "the", "test", "to", "the", "listener" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/jsunit/Assert.js#L128-L144
train
ariatemplates/ariatemplates
src/aria/jsunit/Assert.js
function (value, optMsg) { this._assertCount++; this._totalAssertCount++; if (value !== true) { var msg = "Assert #" + this._assertCount + " failed"; if (optMsg) { msg += " : " + optMsg; } this.raiseFailure(msg); if (console && ariaUtilsType.isFunction(console.trace)) { console.assert(false, "Stack trace for failed Assert #" + this._assertCount + " in test : [" + this._currentTestName + "]"); } // raise an exception to stop subsequent throw { name : this.ASSERT_FAILURE, message : msg }; } }
javascript
function (value, optMsg) { this._assertCount++; this._totalAssertCount++; if (value !== true) { var msg = "Assert #" + this._assertCount + " failed"; if (optMsg) { msg += " : " + optMsg; } this.raiseFailure(msg); if (console && ariaUtilsType.isFunction(console.trace)) { console.assert(false, "Stack trace for failed Assert #" + this._assertCount + " in test : [" + this._currentTestName + "]"); } // raise an exception to stop subsequent throw { name : this.ASSERT_FAILURE, message : msg }; } }
[ "function", "(", "value", ",", "optMsg", ")", "{", "this", ".", "_assertCount", "++", ";", "this", ".", "_totalAssertCount", "++", ";", "if", "(", "value", "!==", "true", ")", "{", "var", "msg", "=", "\"Assert #\"", "+", "this", ".", "_assertCount", "+", "\" failed\"", ";", "if", "(", "optMsg", ")", "{", "msg", "+=", "\" : \"", "+", "optMsg", ";", "}", "this", ".", "raiseFailure", "(", "msg", ")", ";", "if", "(", "console", "&&", "ariaUtilsType", ".", "isFunction", "(", "console", ".", "trace", ")", ")", "{", "console", ".", "assert", "(", "false", ",", "\"Stack trace for failed Assert #\"", "+", "this", ".", "_assertCount", "+", "\" in test : [\"", "+", "this", ".", "_currentTestName", "+", "\"]\"", ")", ";", "}", "throw", "{", "name", ":", "this", ".", "ASSERT_FAILURE", ",", "message", ":", "msg", "}", ";", "}", "}" ]
Check that value is true - if not a failure will be raised in the test context @param {Boolean} value the value to test @param {String} optMsg optional message to add to the failure description
[ "Check", "that", "value", "is", "true", "-", "if", "not", "a", "failure", "will", "be", "raised", "in", "the", "test", "context" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/jsunit/Assert.js#L166-L188
train
ariatemplates/ariatemplates
src/aria/jsunit/Assert.js
function (errorMsg, count) { var res = null; var logAppender = this._logAppender; var logs = logAppender.getLogs(), errFound = false, newLogs = []; if (!errorMsg) { this.assertTrue(false, "assertErrorInLogs was called with a null error message."); } if (count && count > 0) { res = []; var localCount = 0; for (var i = 0; logs.length > i; i++) { if (localCount < count && logs[i].msgId == errorMsg) { localCount++; res.push(logs[i]); } else { newLogs.push(logs[i]); } } logAppender.setLogs(newLogs); this.assertTrue(localCount == count, "Expected error " + errorMsg + " found " + localCount + " times in logs"); } else { for (var i = 0; logs.length > i; i++) { if (logs[i].msgId == errorMsg) { errFound = true; res = logs[i]; } else { newLogs.push(logs[i]); } } logAppender.setLogs(newLogs); this.assertTrue(errFound, "Expected error not found in logs: " + errorMsg); } return res; }
javascript
function (errorMsg, count) { var res = null; var logAppender = this._logAppender; var logs = logAppender.getLogs(), errFound = false, newLogs = []; if (!errorMsg) { this.assertTrue(false, "assertErrorInLogs was called with a null error message."); } if (count && count > 0) { res = []; var localCount = 0; for (var i = 0; logs.length > i; i++) { if (localCount < count && logs[i].msgId == errorMsg) { localCount++; res.push(logs[i]); } else { newLogs.push(logs[i]); } } logAppender.setLogs(newLogs); this.assertTrue(localCount == count, "Expected error " + errorMsg + " found " + localCount + " times in logs"); } else { for (var i = 0; logs.length > i; i++) { if (logs[i].msgId == errorMsg) { errFound = true; res = logs[i]; } else { newLogs.push(logs[i]); } } logAppender.setLogs(newLogs); this.assertTrue(errFound, "Expected error not found in logs: " + errorMsg); } return res; }
[ "function", "(", "errorMsg", ",", "count", ")", "{", "var", "res", "=", "null", ";", "var", "logAppender", "=", "this", ".", "_logAppender", ";", "var", "logs", "=", "logAppender", ".", "getLogs", "(", ")", ",", "errFound", "=", "false", ",", "newLogs", "=", "[", "]", ";", "if", "(", "!", "errorMsg", ")", "{", "this", ".", "assertTrue", "(", "false", ",", "\"assertErrorInLogs was called with a null error message.\"", ")", ";", "}", "if", "(", "count", "&&", "count", ">", "0", ")", "{", "res", "=", "[", "]", ";", "var", "localCount", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "logs", ".", "length", ">", "i", ";", "i", "++", ")", "{", "if", "(", "localCount", "<", "count", "&&", "logs", "[", "i", "]", ".", "msgId", "==", "errorMsg", ")", "{", "localCount", "++", ";", "res", ".", "push", "(", "logs", "[", "i", "]", ")", ";", "}", "else", "{", "newLogs", ".", "push", "(", "logs", "[", "i", "]", ")", ";", "}", "}", "logAppender", ".", "setLogs", "(", "newLogs", ")", ";", "this", ".", "assertTrue", "(", "localCount", "==", "count", ",", "\"Expected error \"", "+", "errorMsg", "+", "\" found \"", "+", "localCount", "+", "\" times in logs\"", ")", ";", "}", "else", "{", "for", "(", "var", "i", "=", "0", ";", "logs", ".", "length", ">", "i", ";", "i", "++", ")", "{", "if", "(", "logs", "[", "i", "]", ".", "msgId", "==", "errorMsg", ")", "{", "errFound", "=", "true", ";", "res", "=", "logs", "[", "i", "]", ";", "}", "else", "{", "newLogs", ".", "push", "(", "logs", "[", "i", "]", ")", ";", "}", "}", "logAppender", ".", "setLogs", "(", "newLogs", ")", ";", "this", ".", "assertTrue", "(", "errFound", ",", "\"Expected error not found in logs: \"", "+", "errorMsg", ")", ";", "}", "return", "res", ";", "}" ]
Asserts that an error should be present in the logs at least 'count' number of times. Once called, 'count' occurrences of the error will be discarded. If the parameter 'count' is not present, all occurrences will be removed. @param {String} errorMsg Must not be null or undefined @param {Number} count [optional] number of times the error must be present in the logs
[ "Asserts", "that", "an", "error", "should", "be", "present", "in", "the", "logs", "at", "least", "count", "number", "of", "times", ".", "Once", "called", "count", "occurrences", "of", "the", "error", "will", "be", "discarded", ".", "If", "the", "parameter", "count", "is", "not", "present", "all", "occurrences", "will", "be", "removed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/jsunit/Assert.js#L368-L402
train
ariatemplates/ariatemplates
src/aria/jsunit/Assert.js
function (evtName) { for (var i = 0; i < this.evtLogs.length; i++) { if (this.evtLogs[i].name == evtName) { return this.evtLogs[i]; } } return null; }
javascript
function (evtName) { for (var i = 0; i < this.evtLogs.length; i++) { if (this.evtLogs[i].name == evtName) { return this.evtLogs[i]; } } return null; }
[ "function", "(", "evtName", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "evtLogs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "evtLogs", "[", "i", "]", ".", "name", "==", "evtName", ")", "{", "return", "this", ".", "evtLogs", "[", "i", "]", ";", "}", "}", "return", "null", ";", "}" ]
Retrieve the event object corresponding to a given event name @param {String} evtName The name of the event @return {Object} event object corresponding to evtName
[ "Retrieve", "the", "event", "object", "corresponding", "to", "a", "given", "event", "name" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/jsunit/Assert.js#L529-L536
train
ariatemplates/ariatemplates
src/aria/jsunit/Assert.js
function () { if (this._expectedEventsList != null) { this.$raiseEvent({ name : "failure", testClass : this.$classpath, testState : this._currentTestName, description : 'Not all expected events have occured. First missing event (#' + this._eventIndexInList + '): ' + this._expectedEventsList[this._eventIndexInList].name }); this._expectedEventsList = null; } }
javascript
function () { if (this._expectedEventsList != null) { this.$raiseEvent({ name : "failure", testClass : this.$classpath, testState : this._currentTestName, description : 'Not all expected events have occured. First missing event (#' + this._eventIndexInList + '): ' + this._expectedEventsList[this._eventIndexInList].name }); this._expectedEventsList = null; } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_expectedEventsList", "!=", "null", ")", "{", "this", ".", "$raiseEvent", "(", "{", "name", ":", "\"failure\"", ",", "testClass", ":", "this", ".", "$classpath", ",", "testState", ":", "this", ".", "_currentTestName", ",", "description", ":", "'Not all expected events have occured. First missing event (#'", "+", "this", ".", "_eventIndexInList", "+", "'): '", "+", "this", ".", "_expectedEventsList", "[", "this", ".", "_eventIndexInList", "]", ".", "name", "}", ")", ";", "this", ".", "_expectedEventsList", "=", "null", ";", "}", "}" ]
Check that all events in the list registered with registerExpectedEventsList have occurred.
[ "Check", "that", "all", "events", "in", "the", "list", "registered", "with", "registerExpectedEventsList", "have", "occurred", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/jsunit/Assert.js#L609-L621
train
ariatemplates/ariatemplates
src/aria/jsunit/Assert.js
function (initialClass, mockClass) { if (this._overriddenClasses == null) { this._overriddenClasses = {}; } var cacheKey = Aria.getLogicalPath(initialClass, ".js", true); var clsInfos = this._overriddenClasses[initialClass]; if (clsInfos == null) { // only save the previous class if it was not already overridden var currentClass = Aria.nspace(initialClass); if (currentClass == null) { return; // invalid namespace } var idx = initialClass.lastIndexOf('.'); if (idx > -1) { clsInfos = { clsNs : initialClass.slice(0, idx), clsName : initialClass.slice(idx + 1), initialClass : currentClass }; } else { clsInfos = { clsNs : '', clsName : initialClass, initialClass : currentClass }; } clsInfos.cachedModule = require.cache[cacheKey]; this._overriddenClasses[initialClass] = clsInfos; } // alter the global classpath to point to the mock var ns = Aria.nspace(clsInfos.clsNs); ns[clsInfos.clsName] = mockClass; // also alter require cache delete require.cache[cacheKey]; var currentContext = require("noder-js/currentContext"); var modull; if (currentContext) { modull = currentContext.getModule(cacheKey); } else { modull = { id : cacheKey, filename : cacheKey }; require.cache[cacheKey] = modull; } modull.exports = mockClass; modull.loaded = true; modull.preloaded = true; }
javascript
function (initialClass, mockClass) { if (this._overriddenClasses == null) { this._overriddenClasses = {}; } var cacheKey = Aria.getLogicalPath(initialClass, ".js", true); var clsInfos = this._overriddenClasses[initialClass]; if (clsInfos == null) { // only save the previous class if it was not already overridden var currentClass = Aria.nspace(initialClass); if (currentClass == null) { return; // invalid namespace } var idx = initialClass.lastIndexOf('.'); if (idx > -1) { clsInfos = { clsNs : initialClass.slice(0, idx), clsName : initialClass.slice(idx + 1), initialClass : currentClass }; } else { clsInfos = { clsNs : '', clsName : initialClass, initialClass : currentClass }; } clsInfos.cachedModule = require.cache[cacheKey]; this._overriddenClasses[initialClass] = clsInfos; } // alter the global classpath to point to the mock var ns = Aria.nspace(clsInfos.clsNs); ns[clsInfos.clsName] = mockClass; // also alter require cache delete require.cache[cacheKey]; var currentContext = require("noder-js/currentContext"); var modull; if (currentContext) { modull = currentContext.getModule(cacheKey); } else { modull = { id : cacheKey, filename : cacheKey }; require.cache[cacheKey] = modull; } modull.exports = mockClass; modull.loaded = true; modull.preloaded = true; }
[ "function", "(", "initialClass", ",", "mockClass", ")", "{", "if", "(", "this", ".", "_overriddenClasses", "==", "null", ")", "{", "this", ".", "_overriddenClasses", "=", "{", "}", ";", "}", "var", "cacheKey", "=", "Aria", ".", "getLogicalPath", "(", "initialClass", ",", "\".js\"", ",", "true", ")", ";", "var", "clsInfos", "=", "this", ".", "_overriddenClasses", "[", "initialClass", "]", ";", "if", "(", "clsInfos", "==", "null", ")", "{", "var", "currentClass", "=", "Aria", ".", "nspace", "(", "initialClass", ")", ";", "if", "(", "currentClass", "==", "null", ")", "{", "return", ";", "}", "var", "idx", "=", "initialClass", ".", "lastIndexOf", "(", "'.'", ")", ";", "if", "(", "idx", ">", "-", "1", ")", "{", "clsInfos", "=", "{", "clsNs", ":", "initialClass", ".", "slice", "(", "0", ",", "idx", ")", ",", "clsName", ":", "initialClass", ".", "slice", "(", "idx", "+", "1", ")", ",", "initialClass", ":", "currentClass", "}", ";", "}", "else", "{", "clsInfos", "=", "{", "clsNs", ":", "''", ",", "clsName", ":", "initialClass", ",", "initialClass", ":", "currentClass", "}", ";", "}", "clsInfos", ".", "cachedModule", "=", "require", ".", "cache", "[", "cacheKey", "]", ";", "this", ".", "_overriddenClasses", "[", "initialClass", "]", "=", "clsInfos", ";", "}", "var", "ns", "=", "Aria", ".", "nspace", "(", "clsInfos", ".", "clsNs", ")", ";", "ns", "[", "clsInfos", ".", "clsName", "]", "=", "mockClass", ";", "delete", "require", ".", "cache", "[", "cacheKey", "]", ";", "var", "currentContext", "=", "require", "(", "\"noder-js/currentContext\"", ")", ";", "var", "modull", ";", "if", "(", "currentContext", ")", "{", "modull", "=", "currentContext", ".", "getModule", "(", "cacheKey", ")", ";", "}", "else", "{", "modull", "=", "{", "id", ":", "cacheKey", ",", "filename", ":", "cacheKey", "}", ";", "require", ".", "cache", "[", "cacheKey", "]", "=", "modull", ";", "}", "modull", ".", "exports", "=", "mockClass", ";", "modull", ".", "loaded", "=", "true", ";", "modull", ".", "preloaded", "=", "true", ";", "}" ]
Overrides a class with another. @param {String} Classpath of the class to be overridden (e.g. 'aria.core.DownloadMgr') @param {Object} Overriding class (e.g. test.aria.core.DownloadMgrMock) If the class was already overridden, the current class with namespace initialClass is not saved. It is not specific to classes which use the Aria.classDefinition mechanism (does not use $class and $package)
[ "Overrides", "a", "class", "with", "another", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/jsunit/Assert.js#L641-L690
train
ariatemplates/ariatemplates
src/aria/jsunit/Assert.js
function () { if (this._overriddenClasses != null) { for (var i in this._overriddenClasses) { var clsInfos = this._overriddenClasses[i]; // restore the global classpath to point to the original var ns = Aria.nspace(clsInfos.clsNs); ns[clsInfos.clsName] = clsInfos.initialClass; // also restore require cache var initialClasspath = clsInfos.clsNs + "." + clsInfos.clsName; var cacheKey = Aria.getLogicalPath(initialClasspath, ".js", true); require.cache[cacheKey] = clsInfos.cachedModule; } this._overriddenClasses = null; } }
javascript
function () { if (this._overriddenClasses != null) { for (var i in this._overriddenClasses) { var clsInfos = this._overriddenClasses[i]; // restore the global classpath to point to the original var ns = Aria.nspace(clsInfos.clsNs); ns[clsInfos.clsName] = clsInfos.initialClass; // also restore require cache var initialClasspath = clsInfos.clsNs + "." + clsInfos.clsName; var cacheKey = Aria.getLogicalPath(initialClasspath, ".js", true); require.cache[cacheKey] = clsInfos.cachedModule; } this._overriddenClasses = null; } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_overriddenClasses", "!=", "null", ")", "{", "for", "(", "var", "i", "in", "this", ".", "_overriddenClasses", ")", "{", "var", "clsInfos", "=", "this", ".", "_overriddenClasses", "[", "i", "]", ";", "var", "ns", "=", "Aria", ".", "nspace", "(", "clsInfos", ".", "clsNs", ")", ";", "ns", "[", "clsInfos", ".", "clsName", "]", "=", "clsInfos", ".", "initialClass", ";", "var", "initialClasspath", "=", "clsInfos", ".", "clsNs", "+", "\".\"", "+", "clsInfos", ".", "clsName", ";", "var", "cacheKey", "=", "Aria", ".", "getLogicalPath", "(", "initialClasspath", ",", "\".js\"", ",", "true", ")", ";", "require", ".", "cache", "[", "cacheKey", "]", "=", "clsInfos", ".", "cachedModule", ";", "}", "this", ".", "_overriddenClasses", "=", "null", ";", "}", "}" ]
Reset overridden classes.
[ "Reset", "overridden", "classes", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/jsunit/Assert.js#L695-L711
train
ariatemplates/ariatemplates
src/aria/core/FileLoader.js
function () { if (this._isProcessing) { return; } this.$assert(33, this._logicalPaths.length > 0); this._isProcessing = true; (require("./IO")).asyncRequest({ sender : { classpath : this.$classpath, logicalPaths : this._logicalPaths }, url : require("./DownloadMgr").getURLWithTimestamp(this._url), // add a timestamp to the URL if // required callback : { fn : this._onFileReceive, onerror : this._onFileReceive, scope : this }, expectedResponseType : "text" }); }
javascript
function () { if (this._isProcessing) { return; } this.$assert(33, this._logicalPaths.length > 0); this._isProcessing = true; (require("./IO")).asyncRequest({ sender : { classpath : this.$classpath, logicalPaths : this._logicalPaths }, url : require("./DownloadMgr").getURLWithTimestamp(this._url), // add a timestamp to the URL if // required callback : { fn : this._onFileReceive, onerror : this._onFileReceive, scope : this }, expectedResponseType : "text" }); }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_isProcessing", ")", "{", "return", ";", "}", "this", ".", "$assert", "(", "33", ",", "this", ".", "_logicalPaths", ".", "length", ">", "0", ")", ";", "this", ".", "_isProcessing", "=", "true", ";", "(", "require", "(", "\"./IO\"", ")", ")", ".", "asyncRequest", "(", "{", "sender", ":", "{", "classpath", ":", "this", ".", "$classpath", ",", "logicalPaths", ":", "this", ".", "_logicalPaths", "}", ",", "url", ":", "require", "(", "\"./DownloadMgr\"", ")", ".", "getURLWithTimestamp", "(", "this", ".", "_url", ")", ",", "callback", ":", "{", "fn", ":", "this", ".", "_onFileReceive", ",", "onerror", ":", "this", ".", "_onFileReceive", ",", "scope", ":", "this", "}", ",", "expectedResponseType", ":", "\"text\"", "}", ")", ";", "}" ]
Start the download of the file associated to the loader url
[ "Start", "the", "download", "of", "the", "file", "associated", "to", "the", "loader", "url" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/FileLoader.js#L76-L96
train
ariatemplates/ariatemplates
src/aria/templates/ModuleCtrlFactory.js
function (args, ex) { if (ex) { this.$logError(this.EXCEPTION_CREATING_MODULECTRL, [args.desc.classpath], ex); } this.$callback(args.cb, { error : true }); }
javascript
function (args, ex) { if (ex) { this.$logError(this.EXCEPTION_CREATING_MODULECTRL, [args.desc.classpath], ex); } this.$callback(args.cb, { error : true }); }
[ "function", "(", "args", ",", "ex", ")", "{", "if", "(", "ex", ")", "{", "this", ".", "$logError", "(", "this", ".", "EXCEPTION_CREATING_MODULECTRL", ",", "[", "args", ".", "desc", ".", "classpath", "]", ",", "ex", ")", ";", "}", "this", ".", "$callback", "(", "args", ".", "cb", ",", "{", "error", ":", "true", "}", ")", ";", "}" ]
Error callback method called if there is a failure while loading the module controller class, or the flow controller class. It is also called if there is an exception in the module controller creation process. @param {Object} args @param {Object} ex exception @private
[ "Error", "callback", "method", "called", "if", "there", "is", "a", "failure", "while", "loading", "the", "module", "controller", "class", "or", "the", "flow", "controller", "class", ".", "It", "is", "also", "called", "if", "there", "is", "an", "exception", "in", "the", "module", "controller", "creation", "process", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ModuleCtrlFactory.js#L64-L71
train
ariatemplates/ariatemplates
src/aria/templates/ModuleCtrlFactory.js
function (desc, cb, skipInit) { var args = { desc : desc, cb : cb, skipInit : skipInit }; createModuleCtrl.call(this, args); }
javascript
function (desc, cb, skipInit) { var args = { desc : desc, cb : cb, skipInit : skipInit }; createModuleCtrl.call(this, args); }
[ "function", "(", "desc", ",", "cb", ",", "skipInit", ")", "{", "var", "args", "=", "{", "desc", ":", "desc", ",", "cb", ":", "cb", ",", "skipInit", ":", "skipInit", "}", ";", "createModuleCtrl", ".", "call", "(", "this", ",", "args", ")", ";", "}" ]
Create a module controller and its corresponding flow controller according to its description object and send in the callback an object. The callback may be called synchronously if the initialization can be done synchronously. @param {aria.templates.CfgBeans:InitModuleCtrl} desc Module controller description @param {aria.core.CfgBeans:Callback} cb Callback, which will be called with a json object containing the following properties <ul> <li><code>error</code>: (Boolean) if true, there was an error during module controller creation and the error was logged. In this case, the other properties are not defined. Note that if a custom sub-module of this module failed to be loaded, this is not considered as an error in the load of this module (error = false).</li> <li><code>moduleCtrl</code>: the module controller public interface</li> <li><code>moduleCtrlPrivate</code>: the module controller whole object (should only be used for debugging purposes and for the call of the $dispose method)</li> </ul> @param {Boolean} skipInit if true, the init method is not called on the module controller (allows the caller to call it itself, possibly adding itself as a listener before calling the init method)
[ "Create", "a", "module", "controller", "and", "its", "corresponding", "flow", "controller", "according", "to", "its", "description", "object", "and", "send", "in", "the", "callback", "an", "object", ".", "The", "callback", "may", "be", "called", "synchronously", "if", "the", "initialization", "can", "be", "done", "synchronously", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ModuleCtrlFactory.js#L665-L672
train
ariatemplates/ariatemplates
src/aria/templates/ModuleCtrlFactory.js
function (moduleCtrlPrivate, subModulesArray, cb) { var res = getModulePrivateInfoWithCheck(moduleCtrlPrivate, "loadSubModules"); if (!res) { return this.$callback(cb, { error : true }); } loadSubModules.call(this, res, subModulesArray, cb, false /* these are not custom modules */); }
javascript
function (moduleCtrlPrivate, subModulesArray, cb) { var res = getModulePrivateInfoWithCheck(moduleCtrlPrivate, "loadSubModules"); if (!res) { return this.$callback(cb, { error : true }); } loadSubModules.call(this, res, subModulesArray, cb, false /* these are not custom modules */); }
[ "function", "(", "moduleCtrlPrivate", ",", "subModulesArray", ",", "cb", ")", "{", "var", "res", "=", "getModulePrivateInfoWithCheck", "(", "moduleCtrlPrivate", ",", "\"loadSubModules\"", ")", ";", "if", "(", "!", "res", ")", "{", "return", "this", ".", "$callback", "(", "cb", ",", "{", "error", ":", "true", "}", ")", ";", "}", "loadSubModules", ".", "call", "(", "this", ",", "res", ",", "subModulesArray", ",", "cb", ",", "false", ")", ";", "}" ]
This method should only be called from aria.templates.ModuleCtrl to load sub-modules. @param {aria.templates.ModuleCtrl} moduleCtrlPrivate module controller instance to which child modules should be attached @param {Array} array of type aria.templates.CfgBeans.SubModuleDefinition, giving information about which modules are to be loaded and how. @param {aria.core.CfgBeans:Callback} cb callback to be called when the load is complete (may have failed, though) @private
[ "This", "method", "should", "only", "be", "called", "from", "aria", ".", "templates", ".", "ModuleCtrl", "to", "load", "sub", "-", "modules", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ModuleCtrlFactory.js#L707-L715
train
ariatemplates/ariatemplates
src/aria/templates/ModuleCtrlFactory.js
function (moduleCtrlPrivate) { if (moduleCtrlPrivate == null) { return false; } var k = moduleCtrlPrivate[MODULECTRL_ID_PROPERTY]; var res = modulesPrivateInfo[k]; if (!res) { return false; } if (res.moduleCtrlPrivate != moduleCtrlPrivate) { return false; } var subModuleInfos = res.subModuleInfos; return (subModuleInfos != null); }
javascript
function (moduleCtrlPrivate) { if (moduleCtrlPrivate == null) { return false; } var k = moduleCtrlPrivate[MODULECTRL_ID_PROPERTY]; var res = modulesPrivateInfo[k]; if (!res) { return false; } if (res.moduleCtrlPrivate != moduleCtrlPrivate) { return false; } var subModuleInfos = res.subModuleInfos; return (subModuleInfos != null); }
[ "function", "(", "moduleCtrlPrivate", ")", "{", "if", "(", "moduleCtrlPrivate", "==", "null", ")", "{", "return", "false", ";", "}", "var", "k", "=", "moduleCtrlPrivate", "[", "MODULECTRL_ID_PROPERTY", "]", ";", "var", "res", "=", "modulesPrivateInfo", "[", "k", "]", ";", "if", "(", "!", "res", ")", "{", "return", "false", ";", "}", "if", "(", "res", ".", "moduleCtrlPrivate", "!=", "moduleCtrlPrivate", ")", "{", "return", "false", ";", "}", "var", "subModuleInfos", "=", "res", ".", "subModuleInfos", ";", "return", "(", "subModuleInfos", "!=", "null", ")", ";", "}" ]
Return true if the argument passed is a module controller whole object instance that is reloadable, false otherwise. @param {aria.templates.ModuleCtrl} moduleCtrlPrivate module controller whole object instance. @return {Boolean}
[ "Return", "true", "if", "the", "argument", "passed", "is", "a", "module", "controller", "whole", "object", "instance", "that", "is", "reloadable", "false", "otherwise", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ModuleCtrlFactory.js#L736-L750
train
ariatemplates/ariatemplates
src/aria/templates/ModuleCtrlFactory.js
function (moduleCtrlPrivate, cb) { var res = getModulePrivateInfoWithCheck(moduleCtrlPrivate, "reloadModuleCtrl"); if (!res) { // error is already logged return; } var subModuleInfos = res.subModuleInfos; if (subModuleInfos == null) { this.$logError(this.RELOAD_ONLY_FOR_SUBMODULES, [moduleCtrlPrivate.$classpath]); return; } var parentModule = subModuleInfos.parentModule; this.$assert(668, parentModule != null); var oldModuleCtrl = res.moduleCtrl; var oldFlowCtrl = res.flowCtrl; var classMgr = ariaCoreClassMgr; var toBeUnloaded = [moduleCtrlPrivate.$classpath, moduleCtrlPrivate.$publicInterfaceName]; var flowCtrlPrivate = res.flowCtrlPrivate; if (flowCtrlPrivate) { toBeUnloaded[2] = flowCtrlPrivate.$classpath; toBeUnloaded[3] = flowCtrlPrivate.$publicInterfaceName; } var objectLoading = new ariaTemplatesObjectLoading(); moduleCtrlPrivate.__$reloadingObject = objectLoading; moduleCtrlPrivate.$dispose(); for (var i = 0, l = toBeUnloaded.length; i < l; i++) { classMgr.unloadClass(toBeUnloaded[i], true); } loadSubModules.call(this, parentModule, [subModuleInfos.subModuleDesc], { fn : reloadModuleCtrlCb, scope : this, args : { objectLoading : objectLoading, oldModuleCtrl : oldModuleCtrl, oldFlowCtrl : oldFlowCtrl, callback : cb } }, subModuleInfos.customModule); }
javascript
function (moduleCtrlPrivate, cb) { var res = getModulePrivateInfoWithCheck(moduleCtrlPrivate, "reloadModuleCtrl"); if (!res) { // error is already logged return; } var subModuleInfos = res.subModuleInfos; if (subModuleInfos == null) { this.$logError(this.RELOAD_ONLY_FOR_SUBMODULES, [moduleCtrlPrivate.$classpath]); return; } var parentModule = subModuleInfos.parentModule; this.$assert(668, parentModule != null); var oldModuleCtrl = res.moduleCtrl; var oldFlowCtrl = res.flowCtrl; var classMgr = ariaCoreClassMgr; var toBeUnloaded = [moduleCtrlPrivate.$classpath, moduleCtrlPrivate.$publicInterfaceName]; var flowCtrlPrivate = res.flowCtrlPrivate; if (flowCtrlPrivate) { toBeUnloaded[2] = flowCtrlPrivate.$classpath; toBeUnloaded[3] = flowCtrlPrivate.$publicInterfaceName; } var objectLoading = new ariaTemplatesObjectLoading(); moduleCtrlPrivate.__$reloadingObject = objectLoading; moduleCtrlPrivate.$dispose(); for (var i = 0, l = toBeUnloaded.length; i < l; i++) { classMgr.unloadClass(toBeUnloaded[i], true); } loadSubModules.call(this, parentModule, [subModuleInfos.subModuleDesc], { fn : reloadModuleCtrlCb, scope : this, args : { objectLoading : objectLoading, oldModuleCtrl : oldModuleCtrl, oldFlowCtrl : oldFlowCtrl, callback : cb } }, subModuleInfos.customModule); }
[ "function", "(", "moduleCtrlPrivate", ",", "cb", ")", "{", "var", "res", "=", "getModulePrivateInfoWithCheck", "(", "moduleCtrlPrivate", ",", "\"reloadModuleCtrl\"", ")", ";", "if", "(", "!", "res", ")", "{", "return", ";", "}", "var", "subModuleInfos", "=", "res", ".", "subModuleInfos", ";", "if", "(", "subModuleInfos", "==", "null", ")", "{", "this", ".", "$logError", "(", "this", ".", "RELOAD_ONLY_FOR_SUBMODULES", ",", "[", "moduleCtrlPrivate", ".", "$classpath", "]", ")", ";", "return", ";", "}", "var", "parentModule", "=", "subModuleInfos", ".", "parentModule", ";", "this", ".", "$assert", "(", "668", ",", "parentModule", "!=", "null", ")", ";", "var", "oldModuleCtrl", "=", "res", ".", "moduleCtrl", ";", "var", "oldFlowCtrl", "=", "res", ".", "flowCtrl", ";", "var", "classMgr", "=", "ariaCoreClassMgr", ";", "var", "toBeUnloaded", "=", "[", "moduleCtrlPrivate", ".", "$classpath", ",", "moduleCtrlPrivate", ".", "$publicInterfaceName", "]", ";", "var", "flowCtrlPrivate", "=", "res", ".", "flowCtrlPrivate", ";", "if", "(", "flowCtrlPrivate", ")", "{", "toBeUnloaded", "[", "2", "]", "=", "flowCtrlPrivate", ".", "$classpath", ";", "toBeUnloaded", "[", "3", "]", "=", "flowCtrlPrivate", ".", "$publicInterfaceName", ";", "}", "var", "objectLoading", "=", "new", "ariaTemplatesObjectLoading", "(", ")", ";", "moduleCtrlPrivate", ".", "__$reloadingObject", "=", "objectLoading", ";", "moduleCtrlPrivate", ".", "$dispose", "(", ")", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "toBeUnloaded", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "classMgr", ".", "unloadClass", "(", "toBeUnloaded", "[", "i", "]", ",", "true", ")", ";", "}", "loadSubModules", ".", "call", "(", "this", ",", "parentModule", ",", "[", "subModuleInfos", ".", "subModuleDesc", "]", ",", "{", "fn", ":", "reloadModuleCtrlCb", ",", "scope", ":", "this", ",", "args", ":", "{", "objectLoading", ":", "objectLoading", ",", "oldModuleCtrl", ":", "oldModuleCtrl", ",", "oldFlowCtrl", ":", "oldFlowCtrl", ",", "callback", ":", "cb", "}", "}", ",", "subModuleInfos", ".", "customModule", ")", ";", "}" ]
Reload a module controller. A module can be dynamically reloaded only if it is a sub-module. To check if a module controller is reloadable, you can use isModuleReloadable. @param {aria.templates.ModuleCtrl} moduleCtrlPrivate module controller instance which is to be reloaded @param {aria.core.CfgBeans:Callback} cb callback
[ "Reload", "a", "module", "controller", ".", "A", "module", "can", "be", "dynamically", "reloaded", "only", "if", "it", "is", "a", "sub", "-", "module", ".", "To", "check", "if", "a", "module", "controller", "is", "reloadable", "you", "can", "use", "isModuleReloadable", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ModuleCtrlFactory.js#L758-L797
train
ariatemplates/ariatemplates
src/aria/templates/ModuleCtrlFactory.js
function (moduleCtrlPrivate) { var k = moduleCtrlPrivate[MODULECTRL_ID_PROPERTY]; var res = getModulePrivateInfoWithCheck(moduleCtrlPrivate, "notifyModuleCtrlDisposed"); if (!res) { // error is already logged return; } res.isDisposing = true; var subModuleInfos = res.subModuleInfos; var parentModule = subModuleInfos ? subModuleInfos.parentModule : null; if (parentModule && !parentModule.isDisposing) { // This module is a sub-module and its parent module is not being disposed // remove the module from parent array of sub-modules ariaUtilsArray.remove(parentModule.subModules, moduleCtrlPrivate); // remove module controller from refpath: putSubModuleAtRefPath.call(this, parentModule, subModuleInfos.subModuleDesc, null, subModuleInfos.customModule); } // dispose sub-modules (including custom modules): var subModules = res.subModules; if (subModules) { for (var i = subModules.length - 1; i >= 0; i--) { try { subModules[i].$dispose(); } catch (ex) { // an error when disposing a sub-module must never prevent the parent module to be disposed // (especially if the child module is a custom module) this.$logError(this.EXCEPTION_SUBMODULE_DISPOSE, [moduleCtrlPrivate.$classpath, subModules[i].$classpath], ex); } } res.subModules = null; } modulesPrivateInfo[k] = null; delete modulesPrivateInfo[k]; if (res.flowCtrlPrivate) { res.flowCtrlPrivate.$dispose(); res.flowCtrlPrivate = null; res.flowCtrl = null; } res.moduleCtrl = null; res.moduleCtrlPrivate = null; res.subModuleInfos = null; }
javascript
function (moduleCtrlPrivate) { var k = moduleCtrlPrivate[MODULECTRL_ID_PROPERTY]; var res = getModulePrivateInfoWithCheck(moduleCtrlPrivate, "notifyModuleCtrlDisposed"); if (!res) { // error is already logged return; } res.isDisposing = true; var subModuleInfos = res.subModuleInfos; var parentModule = subModuleInfos ? subModuleInfos.parentModule : null; if (parentModule && !parentModule.isDisposing) { // This module is a sub-module and its parent module is not being disposed // remove the module from parent array of sub-modules ariaUtilsArray.remove(parentModule.subModules, moduleCtrlPrivate); // remove module controller from refpath: putSubModuleAtRefPath.call(this, parentModule, subModuleInfos.subModuleDesc, null, subModuleInfos.customModule); } // dispose sub-modules (including custom modules): var subModules = res.subModules; if (subModules) { for (var i = subModules.length - 1; i >= 0; i--) { try { subModules[i].$dispose(); } catch (ex) { // an error when disposing a sub-module must never prevent the parent module to be disposed // (especially if the child module is a custom module) this.$logError(this.EXCEPTION_SUBMODULE_DISPOSE, [moduleCtrlPrivate.$classpath, subModules[i].$classpath], ex); } } res.subModules = null; } modulesPrivateInfo[k] = null; delete modulesPrivateInfo[k]; if (res.flowCtrlPrivate) { res.flowCtrlPrivate.$dispose(); res.flowCtrlPrivate = null; res.flowCtrl = null; } res.moduleCtrl = null; res.moduleCtrlPrivate = null; res.subModuleInfos = null; }
[ "function", "(", "moduleCtrlPrivate", ")", "{", "var", "k", "=", "moduleCtrlPrivate", "[", "MODULECTRL_ID_PROPERTY", "]", ";", "var", "res", "=", "getModulePrivateInfoWithCheck", "(", "moduleCtrlPrivate", ",", "\"notifyModuleCtrlDisposed\"", ")", ";", "if", "(", "!", "res", ")", "{", "return", ";", "}", "res", ".", "isDisposing", "=", "true", ";", "var", "subModuleInfos", "=", "res", ".", "subModuleInfos", ";", "var", "parentModule", "=", "subModuleInfos", "?", "subModuleInfos", ".", "parentModule", ":", "null", ";", "if", "(", "parentModule", "&&", "!", "parentModule", ".", "isDisposing", ")", "{", "ariaUtilsArray", ".", "remove", "(", "parentModule", ".", "subModules", ",", "moduleCtrlPrivate", ")", ";", "putSubModuleAtRefPath", ".", "call", "(", "this", ",", "parentModule", ",", "subModuleInfos", ".", "subModuleDesc", ",", "null", ",", "subModuleInfos", ".", "customModule", ")", ";", "}", "var", "subModules", "=", "res", ".", "subModules", ";", "if", "(", "subModules", ")", "{", "for", "(", "var", "i", "=", "subModules", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "try", "{", "subModules", "[", "i", "]", ".", "$dispose", "(", ")", ";", "}", "catch", "(", "ex", ")", "{", "this", ".", "$logError", "(", "this", ".", "EXCEPTION_SUBMODULE_DISPOSE", ",", "[", "moduleCtrlPrivate", ".", "$classpath", ",", "subModules", "[", "i", "]", ".", "$classpath", "]", ",", "ex", ")", ";", "}", "}", "res", ".", "subModules", "=", "null", ";", "}", "modulesPrivateInfo", "[", "k", "]", "=", "null", ";", "delete", "modulesPrivateInfo", "[", "k", "]", ";", "if", "(", "res", ".", "flowCtrlPrivate", ")", "{", "res", ".", "flowCtrlPrivate", ".", "$dispose", "(", ")", ";", "res", ".", "flowCtrlPrivate", "=", "null", ";", "res", ".", "flowCtrl", "=", "null", ";", "}", "res", ".", "moduleCtrl", "=", "null", ";", "res", ".", "moduleCtrlPrivate", "=", "null", ";", "res", ".", "subModuleInfos", "=", "null", ";", "}" ]
This method should only be called from aria.templates.ModuleCtrl when a module controller is disposed, so that its sub-modules and flow can be disposed as well. @param {aria.templates.ModuleCtrl} moduleCtrlPrivate module controller instance which is being disposed @private
[ "This", "method", "should", "only", "be", "called", "from", "aria", ".", "templates", ".", "ModuleCtrl", "when", "a", "module", "controller", "is", "disposed", "so", "that", "its", "sub", "-", "modules", "and", "flow", "can", "be", "disposed", "as", "well", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/ModuleCtrlFactory.js#L805-L848
train
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinInterface.js
function (widgetName, skinClass, skipError) { var widgetSkinObj = this.getSkinClasses(widgetName); if (widgetSkinObj) { if (skinClass == null) { skinClass = 'std'; } var skinClassObj = widgetSkinObj[skinClass]; if (skinClassObj) { return skinClassObj; } else if (!skipError) { this.$logWarn(this.WIDGET_SKIN_CLASS_OBJECT_NOT_FOUND, [skinClass, widgetName]); return widgetSkinObj.std; } return null; } }
javascript
function (widgetName, skinClass, skipError) { var widgetSkinObj = this.getSkinClasses(widgetName); if (widgetSkinObj) { if (skinClass == null) { skinClass = 'std'; } var skinClassObj = widgetSkinObj[skinClass]; if (skinClassObj) { return skinClassObj; } else if (!skipError) { this.$logWarn(this.WIDGET_SKIN_CLASS_OBJECT_NOT_FOUND, [skinClass, widgetName]); return widgetSkinObj.std; } return null; } }
[ "function", "(", "widgetName", ",", "skinClass", ",", "skipError", ")", "{", "var", "widgetSkinObj", "=", "this", ".", "getSkinClasses", "(", "widgetName", ")", ";", "if", "(", "widgetSkinObj", ")", "{", "if", "(", "skinClass", "==", "null", ")", "{", "skinClass", "=", "'std'", ";", "}", "var", "skinClassObj", "=", "widgetSkinObj", "[", "skinClass", "]", ";", "if", "(", "skinClassObj", ")", "{", "return", "skinClassObj", ";", "}", "else", "if", "(", "!", "skipError", ")", "{", "this", ".", "$logWarn", "(", "this", ".", "WIDGET_SKIN_CLASS_OBJECT_NOT_FOUND", ",", "[", "skinClass", ",", "widgetName", "]", ")", ";", "return", "widgetSkinObj", ".", "std", ";", "}", "return", "null", ";", "}", "}" ]
Returns the skin configuration for the given skin class of the given widget. It is normalized if it was not done before. If the skin class does not exist, returns the std one with a warning on the console, unless skipError is true. @param {String} widgetName name of the widget (in fact, the skinnable class, which may not correspond exactly to widgets) @param {String} skinClass @param {Boolean} skipError @return {Object}
[ "Returns", "the", "skin", "configuration", "for", "the", "given", "skin", "class", "of", "the", "given", "widget", ".", "It", "is", "normalized", "if", "it", "was", "not", "done", "before", ".", "If", "the", "skin", "class", "does", "not", "exist", "returns", "the", "std", "one", "with", "a", "warning", "on", "the", "console", "unless", "skipError", "is", "true", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinInterface.js#L88-L103
train
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinInterface.js
function (widgetName) { var widgetSkinObj = aria.widgets.AriaSkin.skinObject[widgetName]; if (!widgetSkinObj || !widgetSkinObj['aria:skinNormalized']) { var newValue = ariaWidgetsAriaSkinNormalization.normalizeWidget(widgetName, widgetSkinObj); if (newValue && newValue != widgetSkinObj) { widgetSkinObj = newValue; aria.widgets.AriaSkin.skinObject[widgetName] = newValue; } } return widgetSkinObj; }
javascript
function (widgetName) { var widgetSkinObj = aria.widgets.AriaSkin.skinObject[widgetName]; if (!widgetSkinObj || !widgetSkinObj['aria:skinNormalized']) { var newValue = ariaWidgetsAriaSkinNormalization.normalizeWidget(widgetName, widgetSkinObj); if (newValue && newValue != widgetSkinObj) { widgetSkinObj = newValue; aria.widgets.AriaSkin.skinObject[widgetName] = newValue; } } return widgetSkinObj; }
[ "function", "(", "widgetName", ")", "{", "var", "widgetSkinObj", "=", "aria", ".", "widgets", ".", "AriaSkin", ".", "skinObject", "[", "widgetName", "]", ";", "if", "(", "!", "widgetSkinObj", "||", "!", "widgetSkinObj", "[", "'aria:skinNormalized'", "]", ")", "{", "var", "newValue", "=", "ariaWidgetsAriaSkinNormalization", ".", "normalizeWidget", "(", "widgetName", ",", "widgetSkinObj", ")", ";", "if", "(", "newValue", "&&", "newValue", "!=", "widgetSkinObj", ")", "{", "widgetSkinObj", "=", "newValue", ";", "aria", ".", "widgets", ".", "AriaSkin", ".", "skinObject", "[", "widgetName", "]", "=", "newValue", ";", "}", "}", "return", "widgetSkinObj", ";", "}" ]
Returns the skin configuration containing all skin classes for the given widget. This method calls the normalization function, if it was not called before. @param {String} widgetName name of the widget (in fact, the skinnable class, which may not correspond exactly to widgets) @return {Object}
[ "Returns", "the", "skin", "configuration", "containing", "all", "skin", "classes", "for", "the", "given", "widget", ".", "This", "method", "calls", "the", "normalization", "function", "if", "it", "was", "not", "called", "before", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinInterface.js#L112-L122
train
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinInterface.js
function (sprite, icon) { var curSprite = this.getSkinObject("Icon", sprite, true), iconContent, iconLeft = 0, iconTop = 0; if (curSprite && (iconContent = curSprite.content[icon]) !== undefined) { if (curSprite.biDimensional) { var XY = iconContent.split("_"); iconLeft = (curSprite.iconWidth + curSprite.spriteSpacing) * XY[0]; iconTop = (curSprite.iconHeight + curSprite.spriteSpacing) * XY[1]; } else if (curSprite.direction === "x") { iconLeft = (curSprite.iconWidth + curSprite.spriteSpacing) * iconContent; } else if (curSprite.direction === "y") { iconTop = (curSprite.iconHeight + curSprite.spriteSpacing) * iconContent; } return { "iconLeft" : iconLeft, "iconTop" : iconTop, "cssClass" : "xICN" + sprite, "spriteURL" : curSprite.spriteURL, "width" : curSprite.iconWidth, "height" : curSprite.iconHeight, "borderLeft" : curSprite.borderLeft, "borderRight" : curSprite.borderRight, "borderTop" : curSprite.borderTop, "borderBottom" : curSprite.borderBottom }; } return false; }
javascript
function (sprite, icon) { var curSprite = this.getSkinObject("Icon", sprite, true), iconContent, iconLeft = 0, iconTop = 0; if (curSprite && (iconContent = curSprite.content[icon]) !== undefined) { if (curSprite.biDimensional) { var XY = iconContent.split("_"); iconLeft = (curSprite.iconWidth + curSprite.spriteSpacing) * XY[0]; iconTop = (curSprite.iconHeight + curSprite.spriteSpacing) * XY[1]; } else if (curSprite.direction === "x") { iconLeft = (curSprite.iconWidth + curSprite.spriteSpacing) * iconContent; } else if (curSprite.direction === "y") { iconTop = (curSprite.iconHeight + curSprite.spriteSpacing) * iconContent; } return { "iconLeft" : iconLeft, "iconTop" : iconTop, "cssClass" : "xICN" + sprite, "spriteURL" : curSprite.spriteURL, "width" : curSprite.iconWidth, "height" : curSprite.iconHeight, "borderLeft" : curSprite.borderLeft, "borderRight" : curSprite.borderRight, "borderTop" : curSprite.borderTop, "borderBottom" : curSprite.borderBottom }; } return false; }
[ "function", "(", "sprite", ",", "icon", ")", "{", "var", "curSprite", "=", "this", ".", "getSkinObject", "(", "\"Icon\"", ",", "sprite", ",", "true", ")", ",", "iconContent", ",", "iconLeft", "=", "0", ",", "iconTop", "=", "0", ";", "if", "(", "curSprite", "&&", "(", "iconContent", "=", "curSprite", ".", "content", "[", "icon", "]", ")", "!==", "undefined", ")", "{", "if", "(", "curSprite", ".", "biDimensional", ")", "{", "var", "XY", "=", "iconContent", ".", "split", "(", "\"_\"", ")", ";", "iconLeft", "=", "(", "curSprite", ".", "iconWidth", "+", "curSprite", ".", "spriteSpacing", ")", "*", "XY", "[", "0", "]", ";", "iconTop", "=", "(", "curSprite", ".", "iconHeight", "+", "curSprite", ".", "spriteSpacing", ")", "*", "XY", "[", "1", "]", ";", "}", "else", "if", "(", "curSprite", ".", "direction", "===", "\"x\"", ")", "{", "iconLeft", "=", "(", "curSprite", ".", "iconWidth", "+", "curSprite", ".", "spriteSpacing", ")", "*", "iconContent", ";", "}", "else", "if", "(", "curSprite", ".", "direction", "===", "\"y\"", ")", "{", "iconTop", "=", "(", "curSprite", ".", "iconHeight", "+", "curSprite", ".", "spriteSpacing", ")", "*", "iconContent", ";", "}", "return", "{", "\"iconLeft\"", ":", "iconLeft", ",", "\"iconTop\"", ":", "iconTop", ",", "\"cssClass\"", ":", "\"xICN\"", "+", "sprite", ",", "\"spriteURL\"", ":", "curSprite", ".", "spriteURL", ",", "\"width\"", ":", "curSprite", ".", "iconWidth", ",", "\"height\"", ":", "curSprite", ".", "iconHeight", ",", "\"borderLeft\"", ":", "curSprite", ".", "borderLeft", ",", "\"borderRight\"", ":", "curSprite", ".", "borderRight", ",", "\"borderTop\"", ":", "curSprite", ".", "borderTop", ",", "\"borderBottom\"", ":", "curSprite", ".", "borderBottom", "}", ";", "}", "return", "false", ";", "}" ]
Return icon information for given sprite and icon name @param {String} sprite @param {String} icon @return {Object}
[ "Return", "icon", "information", "for", "given", "sprite", "and", "icon", "name" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinInterface.js#L162-L188
train
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinInterface.js
function (object, images) { if (object) { var skinImageProperties = this.skinImageProperties; for (var i = 0, l = skinImageProperties.length; i < l; i++) { var propName = skinImageProperties[i]; var value = object[propName]; if (value) { images[value] = 1; } } } }
javascript
function (object, images) { if (object) { var skinImageProperties = this.skinImageProperties; for (var i = 0, l = skinImageProperties.length; i < l; i++) { var propName = skinImageProperties[i]; var value = object[propName]; if (value) { images[value] = 1; } } } }
[ "function", "(", "object", ",", "images", ")", "{", "if", "(", "object", ")", "{", "var", "skinImageProperties", "=", "this", ".", "skinImageProperties", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "skinImageProperties", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "var", "propName", "=", "skinImageProperties", "[", "i", "]", ";", "var", "value", "=", "object", "[", "propName", "]", ";", "if", "(", "value", ")", "{", "images", "[", "value", "]", "=", "1", ";", "}", "}", "}", "}" ]
Extract skin images from an object from the skin and add them to a map. @param {Object} object Object from the skin. It can be either a skin class, a state, a frame or frame state object. Any property of this object whose name is inside this.skinImageProperties is supposed to contain the URL of an image. @param {Object} images Map to which the image urls will be added. Each key in the map is an object URL.
[ "Extract", "skin", "images", "from", "an", "object", "from", "the", "skin", "and", "add", "them", "to", "a", "map", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinInterface.js#L205-L216
train
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinInterface.js
function (color, imageurl, otherparams) { var fullUrl = ""; var gifUrl = ""; if (imageurl) { var imageFullUrl = /^(data|https?):/i.test(imageurl) ? imageurl : this.getSkinImageFullUrl(imageurl); fullUrl = "url(" + imageFullUrl + ") "; if (ariaUtilsString.endsWith(imageurl, ".png")) { gifUrl = imageFullUrl.substring(0, imageFullUrl.length - 4) + ".gif"; } else { gifUrl = imageFullUrl; } } var rule = ["background: ", color, " ", fullUrl, otherparams, ";"]; if (gifUrl) { rule.push("_background-image: url(", gifUrl, ") !important;"); } return rule.join(""); }
javascript
function (color, imageurl, otherparams) { var fullUrl = ""; var gifUrl = ""; if (imageurl) { var imageFullUrl = /^(data|https?):/i.test(imageurl) ? imageurl : this.getSkinImageFullUrl(imageurl); fullUrl = "url(" + imageFullUrl + ") "; if (ariaUtilsString.endsWith(imageurl, ".png")) { gifUrl = imageFullUrl.substring(0, imageFullUrl.length - 4) + ".gif"; } else { gifUrl = imageFullUrl; } } var rule = ["background: ", color, " ", fullUrl, otherparams, ";"]; if (gifUrl) { rule.push("_background-image: url(", gifUrl, ") !important;"); } return rule.join(""); }
[ "function", "(", "color", ",", "imageurl", ",", "otherparams", ")", "{", "var", "fullUrl", "=", "\"\"", ";", "var", "gifUrl", "=", "\"\"", ";", "if", "(", "imageurl", ")", "{", "var", "imageFullUrl", "=", "/", "^(data|https?):", "/", "i", ".", "test", "(", "imageurl", ")", "?", "imageurl", ":", "this", ".", "getSkinImageFullUrl", "(", "imageurl", ")", ";", "fullUrl", "=", "\"url(\"", "+", "imageFullUrl", "+", "\") \"", ";", "if", "(", "ariaUtilsString", ".", "endsWith", "(", "imageurl", ",", "\".png\"", ")", ")", "{", "gifUrl", "=", "imageFullUrl", ".", "substring", "(", "0", ",", "imageFullUrl", ".", "length", "-", "4", ")", "+", "\".gif\"", ";", "}", "else", "{", "gifUrl", "=", "imageFullUrl", ";", "}", "}", "var", "rule", "=", "[", "\"background: \"", ",", "color", ",", "\" \"", ",", "fullUrl", ",", "otherparams", ",", "\";\"", "]", ";", "if", "(", "gifUrl", ")", "{", "rule", ".", "push", "(", "\"_background-image: url(\"", ",", "gifUrl", ",", "\") !important;\"", ")", ";", "}", "return", "rule", ".", "join", "(", "\"\"", ")", ";", "}" ]
Build the backgroung rule of a CSS selector. It is equivalent to the background macro inside .ftl files. It computes the path to the css image from the baseUrl FIXME This function is needed because the packager modifies any url( @param {String} color Color description @param {String} imageurl Image path, relative to the css folder @param {String} otherparams Extra parameters @return {String} full background rule
[ "Build", "the", "backgroung", "rule", "of", "a", "CSS", "selector", ".", "It", "is", "equivalent", "to", "the", "background", "macro", "inside", ".", "ftl", "files", ".", "It", "computes", "the", "path", "to", "the", "css", "image", "from", "the", "baseUrl", "FIXME", "This", "function", "is", "needed", "because", "the", "packager", "modifies", "any", "url", "(" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinInterface.js#L301-L322
train
ariatemplates/ariatemplates
src/aria/widgets/form/DatePicker.js
function (evt) { this.$DropDownTextInput._frame_events.apply(this, arguments); if (evt.event.hasPreventDefault) { evt.event.stopPropagation(); } }
javascript
function (evt) { this.$DropDownTextInput._frame_events.apply(this, arguments); if (evt.event.hasPreventDefault) { evt.event.stopPropagation(); } }
[ "function", "(", "evt", ")", "{", "this", ".", "$DropDownTextInput", ".", "_frame_events", ".", "apply", "(", "this", ",", "arguments", ")", ";", "if", "(", "evt", ".", "event", ".", "hasPreventDefault", ")", "{", "evt", ".", "event", ".", "stopPropagation", "(", ")", ";", "}", "}" ]
Handle events raised by the frame @protected @override @param {Object} evt
[ "Handle", "events", "raised", "by", "the", "frame" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DatePicker.js#L109-L114
train
ariatemplates/ariatemplates
src/aria/widgets/form/DatePicker.js
function (evt) { // when clicking on a date in the calendar, close the calendar, and save the date var date = evt.date; this._closeDropdown(); var report = this.controller.checkValue(date); this._reactToControllerReport(report); }
javascript
function (evt) { // when clicking on a date in the calendar, close the calendar, and save the date var date = evt.date; this._closeDropdown(); var report = this.controller.checkValue(date); this._reactToControllerReport(report); }
[ "function", "(", "evt", ")", "{", "var", "date", "=", "evt", ".", "date", ";", "this", ".", "_closeDropdown", "(", ")", ";", "var", "report", "=", "this", ".", "controller", ".", "checkValue", "(", "date", ")", ";", "this", ".", "_reactToControllerReport", "(", "report", ")", ";", "}" ]
Callback called when the user clicks on a date in the calendar.
[ "Callback", "called", "when", "the", "user", "clicks", "on", "a", "date", "in", "the", "calendar", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DatePicker.js#L119-L126
train
ariatemplates/ariatemplates
src/aria/widgets/form/DatePicker.js
function (property, targetCfg) { var cfg = this._cfg, skinObj = this._skinObj; var calendarProp = 'calendar' + property.substring(0, 1).toUpperCase() + property.substring(1); targetCfg[property] = (typeof cfg[calendarProp] != 'undefined') ? cfg[calendarProp] : skinObj.calendar[property]; }
javascript
function (property, targetCfg) { var cfg = this._cfg, skinObj = this._skinObj; var calendarProp = 'calendar' + property.substring(0, 1).toUpperCase() + property.substring(1); targetCfg[property] = (typeof cfg[calendarProp] != 'undefined') ? cfg[calendarProp] : skinObj.calendar[property]; }
[ "function", "(", "property", ",", "targetCfg", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ",", "skinObj", "=", "this", ".", "_skinObj", ";", "var", "calendarProp", "=", "'calendar'", "+", "property", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")", "+", "property", ".", "substring", "(", "1", ")", ";", "targetCfg", "[", "property", "]", "=", "(", "typeof", "cfg", "[", "calendarProp", "]", "!=", "'undefined'", ")", "?", "cfg", "[", "calendarProp", "]", ":", "skinObj", ".", "calendar", "[", "property", "]", ";", "}" ]
Helper. Does mapping between calendar config property and datepicker configuration, including skin overriding @protected @param {String} property @param {Object} targetCfg, targeted calendar configuration
[ "Helper", ".", "Does", "mapping", "between", "calendar", "config", "property", "and", "datepicker", "configuration", "including", "skin", "overriding" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DatePicker.js#L245-L251
train
ariatemplates/ariatemplates
src/aria/widgets/form/DatePicker.js
function (domEvtWrapper) { if (domEvtWrapper.keyCode === 32) { domEvtWrapper.charCode = 32; } if (this._isShiftF10Pressed(domEvtWrapper)) { this._toggleDropdown(); return; } this._handleKey(domEvtWrapper); }
javascript
function (domEvtWrapper) { if (domEvtWrapper.keyCode === 32) { domEvtWrapper.charCode = 32; } if (this._isShiftF10Pressed(domEvtWrapper)) { this._toggleDropdown(); return; } this._handleKey(domEvtWrapper); }
[ "function", "(", "domEvtWrapper", ")", "{", "if", "(", "domEvtWrapper", ".", "keyCode", "===", "32", ")", "{", "domEvtWrapper", ".", "charCode", "=", "32", ";", "}", "if", "(", "this", ".", "_isShiftF10Pressed", "(", "domEvtWrapper", ")", ")", "{", "this", ".", "_toggleDropdown", "(", ")", ";", "return", ";", "}", "this", ".", "_handleKey", "(", "domEvtWrapper", ")", ";", "}" ]
DOM Event raised when a key is pressed while the focus is on the calendar. @param {aria.templates.DomEventWrapper} domEvtWrapper event
[ "DOM", "Event", "raised", "when", "a", "key", "is", "pressed", "while", "the", "focus", "is", "on", "the", "calendar", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/DatePicker.js#L324-L333
train
ariatemplates/ariatemplates
src/aria/widgets/errorlist/ErrorListTemplateScript.js
function (proto) { // Using push instead of resetting the reference because items are not copied from proto but from the // parameter of tplScriptDefinition directly proto.ICONS.push({ type : ariaUtilsData.TYPE_ERROR, icon : "std:error" }, { type : ariaUtilsData.TYPE_WARNING, icon : "std:warning" }, { type : ariaUtilsData.TYPE_INFO, icon : "std:info" }, { type : ariaUtilsData.TYPE_FATAL, icon : "std:error" }, { type : ariaUtilsData.TYPE_NOTYPE, icon : "std:info" }, { type : ariaUtilsData.TYPE_CRITICAL_WARNING, icon : "std:warning" }, { type : ariaUtilsData.TYPE_CONFIRMATION, icon : "std:confirm" }); }
javascript
function (proto) { // Using push instead of resetting the reference because items are not copied from proto but from the // parameter of tplScriptDefinition directly proto.ICONS.push({ type : ariaUtilsData.TYPE_ERROR, icon : "std:error" }, { type : ariaUtilsData.TYPE_WARNING, icon : "std:warning" }, { type : ariaUtilsData.TYPE_INFO, icon : "std:info" }, { type : ariaUtilsData.TYPE_FATAL, icon : "std:error" }, { type : ariaUtilsData.TYPE_NOTYPE, icon : "std:info" }, { type : ariaUtilsData.TYPE_CRITICAL_WARNING, icon : "std:warning" }, { type : ariaUtilsData.TYPE_CONFIRMATION, icon : "std:confirm" }); }
[ "function", "(", "proto", ")", "{", "proto", ".", "ICONS", ".", "push", "(", "{", "type", ":", "ariaUtilsData", ".", "TYPE_ERROR", ",", "icon", ":", "\"std:error\"", "}", ",", "{", "type", ":", "ariaUtilsData", ".", "TYPE_WARNING", ",", "icon", ":", "\"std:warning\"", "}", ",", "{", "type", ":", "ariaUtilsData", ".", "TYPE_INFO", ",", "icon", ":", "\"std:info\"", "}", ",", "{", "type", ":", "ariaUtilsData", ".", "TYPE_FATAL", ",", "icon", ":", "\"std:error\"", "}", ",", "{", "type", ":", "ariaUtilsData", ".", "TYPE_NOTYPE", ",", "icon", ":", "\"std:info\"", "}", ",", "{", "type", ":", "ariaUtilsData", ".", "TYPE_CRITICAL_WARNING", ",", "icon", ":", "\"std:warning\"", "}", ",", "{", "type", ":", "ariaUtilsData", ".", "TYPE_CONFIRMATION", ",", "icon", ":", "\"std:confirm\"", "}", ")", ";", "}" ]
Initialize this class building the icons object. It's done here so we are sure that aria.utils.Data is already loaded @param {aria.widgets.errorlist.ErrorListTemplateScript} proto Class prototype
[ "Initialize", "this", "class", "building", "the", "icons", "object", ".", "It", "s", "done", "here", "so", "we", "are", "sure", "that", "aria", ".", "utils", ".", "Data", "is", "already", "loaded" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/errorlist/ErrorListTemplateScript.js#L46-L71
train
ariatemplates/ariatemplates
src/aria/widgets/errorlist/ErrorListTemplateScript.js
function () { var messageTypes = this.data.messageTypes; var res = this.DEFAULT_ICON; var icons = this.ICONS; for (var i = 0, l = icons.length; i < l; i++) { var curIcon = icons[i]; if (messageTypes[curIcon.type] > 0) { res = curIcon.icon; break; } } return res; }
javascript
function () { var messageTypes = this.data.messageTypes; var res = this.DEFAULT_ICON; var icons = this.ICONS; for (var i = 0, l = icons.length; i < l; i++) { var curIcon = icons[i]; if (messageTypes[curIcon.type] > 0) { res = curIcon.icon; break; } } return res; }
[ "function", "(", ")", "{", "var", "messageTypes", "=", "this", ".", "data", ".", "messageTypes", ";", "var", "res", "=", "this", ".", "DEFAULT_ICON", ";", "var", "icons", "=", "this", ".", "ICONS", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "icons", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "var", "curIcon", "=", "icons", "[", "i", "]", ";", "if", "(", "messageTypes", "[", "curIcon", ".", "type", "]", ">", "0", ")", "{", "res", "=", "curIcon", ".", "icon", ";", "break", ";", "}", "}", "return", "res", ";", "}" ]
Get the icon name for the current message type @return {String} Icon name
[ "Get", "the", "icon", "name", "for", "the", "current", "message", "type" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/errorlist/ErrorListTemplateScript.js#L100-L112
train
ariatemplates/ariatemplates
src/aria/widgets/errorlist/ErrorListTemplateScript.js
function (msg) { if (this.data.displayCodes && (msg.code || msg.code === 0)) { return msg.localizedMessage + " (" + msg.code + ")"; } return msg.localizedMessage; }
javascript
function (msg) { if (this.data.displayCodes && (msg.code || msg.code === 0)) { return msg.localizedMessage + " (" + msg.code + ")"; } return msg.localizedMessage; }
[ "function", "(", "msg", ")", "{", "if", "(", "this", ".", "data", ".", "displayCodes", "&&", "(", "msg", ".", "code", "||", "msg", ".", "code", "===", "0", ")", ")", "{", "return", "msg", ".", "localizedMessage", "+", "\" (\"", "+", "msg", ".", "code", "+", "\")\"", ";", "}", "return", "msg", ".", "localizedMessage", ";", "}" ]
Get the message to be displayed as label of the error list item @param {Object} msg Error message @return {String} localized message
[ "Get", "the", "message", "to", "be", "displayed", "as", "label", "of", "the", "error", "list", "item" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/errorlist/ErrorListTemplateScript.js#L119-L124
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (pageId, moduleId) { var isCommon = (moduleId.indexOf("common:") != -1); var refpath = this.buildModuleRefpath(moduleId.replace(/^common:/, ""), isCommon, pageId); return this._utils.resolvePath(refpath, this); }
javascript
function (pageId, moduleId) { var isCommon = (moduleId.indexOf("common:") != -1); var refpath = this.buildModuleRefpath(moduleId.replace(/^common:/, ""), isCommon, pageId); return this._utils.resolvePath(refpath, this); }
[ "function", "(", "pageId", ",", "moduleId", ")", "{", "var", "isCommon", "=", "(", "moduleId", ".", "indexOf", "(", "\"common:\"", ")", "!=", "-", "1", ")", ";", "var", "refpath", "=", "this", ".", "buildModuleRefpath", "(", "moduleId", ".", "replace", "(", "/", "^common:", "/", ",", "\"\"", ")", ",", "isCommon", ",", "pageId", ")", ";", "return", "this", ".", "_utils", ".", "resolvePath", "(", "refpath", ",", "this", ")", ";", "}" ]
Get the module controller instance for a specific refpath in a page @param {String} pageId Page identifier @param {String} moduleId Module's refpath as specified in the configuration @return {aria.template.ModuleCtrl} Instance of module controller
[ "Get", "the", "module", "controller", "instance", "for", "a", "specific", "refpath", "in", "a", "page" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L174-L178
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (pageId, modulesDescription, callback) { var definitions = []; var descriptions = []; var modules, refpath, isCommon, def; var loopArray = [{ modules : modulesDescription.page, isCommon : false }, { modules : modulesDescription.common, isCommon : true }]; for (var j = 0; j < 2; j++) { modules = loopArray[j].modules; isCommon = loopArray[j].isCommon; for (var i = 0, len = modules.length; i < len; i += 1) { refpath = this.buildModuleRefpath(modules[i].refpath, isCommon, pageId); if (this._utils.resolvePath(refpath, this) == null) { def = ariaUtilsJson.copy(modules[i]); def.refpath = refpath; definitions.push({ classpath : def.classpath, initArgs : this._injectPageEngine(def.initArgs), refpath : refpath }); descriptions.push(def); this._addRefpath(pageId, isCommon, refpath); } } } this.loadSubModules(definitions, { fn : this.createServices, scope : this, resIndex : -1, args : { pageId : pageId, callback : callback, modules : descriptions } }); }
javascript
function (pageId, modulesDescription, callback) { var definitions = []; var descriptions = []; var modules, refpath, isCommon, def; var loopArray = [{ modules : modulesDescription.page, isCommon : false }, { modules : modulesDescription.common, isCommon : true }]; for (var j = 0; j < 2; j++) { modules = loopArray[j].modules; isCommon = loopArray[j].isCommon; for (var i = 0, len = modules.length; i < len; i += 1) { refpath = this.buildModuleRefpath(modules[i].refpath, isCommon, pageId); if (this._utils.resolvePath(refpath, this) == null) { def = ariaUtilsJson.copy(modules[i]); def.refpath = refpath; definitions.push({ classpath : def.classpath, initArgs : this._injectPageEngine(def.initArgs), refpath : refpath }); descriptions.push(def); this._addRefpath(pageId, isCommon, refpath); } } } this.loadSubModules(definitions, { fn : this.createServices, scope : this, resIndex : -1, args : { pageId : pageId, callback : callback, modules : descriptions } }); }
[ "function", "(", "pageId", ",", "modulesDescription", ",", "callback", ")", "{", "var", "definitions", "=", "[", "]", ";", "var", "descriptions", "=", "[", "]", ";", "var", "modules", ",", "refpath", ",", "isCommon", ",", "def", ";", "var", "loopArray", "=", "[", "{", "modules", ":", "modulesDescription", ".", "page", ",", "isCommon", ":", "false", "}", ",", "{", "modules", ":", "modulesDescription", ".", "common", ",", "isCommon", ":", "true", "}", "]", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "2", ";", "j", "++", ")", "{", "modules", "=", "loopArray", "[", "j", "]", ".", "modules", ";", "isCommon", "=", "loopArray", "[", "j", "]", ".", "isCommon", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "modules", ".", "length", ";", "i", "<", "len", ";", "i", "+=", "1", ")", "{", "refpath", "=", "this", ".", "buildModuleRefpath", "(", "modules", "[", "i", "]", ".", "refpath", ",", "isCommon", ",", "pageId", ")", ";", "if", "(", "this", ".", "_utils", ".", "resolvePath", "(", "refpath", ",", "this", ")", "==", "null", ")", "{", "def", "=", "ariaUtilsJson", ".", "copy", "(", "modules", "[", "i", "]", ")", ";", "def", ".", "refpath", "=", "refpath", ";", "definitions", ".", "push", "(", "{", "classpath", ":", "def", ".", "classpath", ",", "initArgs", ":", "this", ".", "_injectPageEngine", "(", "def", ".", "initArgs", ")", ",", "refpath", ":", "refpath", "}", ")", ";", "descriptions", ".", "push", "(", "def", ")", ";", "this", ".", "_addRefpath", "(", "pageId", ",", "isCommon", ",", "refpath", ")", ";", "}", "}", "}", "this", ".", "loadSubModules", "(", "definitions", ",", "{", "fn", ":", "this", ".", "createServices", ",", "scope", ":", "this", ",", "resIndex", ":", "-", "1", ",", "args", ":", "{", "pageId", ":", "pageId", ",", "callback", ":", "callback", ",", "modules", ":", "descriptions", "}", "}", ")", ";", "}" ]
Load a list of page sub modules. These modules exists only in this page and should be loaded and initialized connecting their datamodel to the defined bindings @param {String} pageId Id of the page, used to prefix a refpath @param {Object} modulesDescriptions <ul> <li> page: List of page-specific modules described by aria.templates.CfgBeans.SubModuleDefinition</li> <li> common: List of common modules described by aria.templates.CfgBeans.SubModuleDefinition</li> </ul> @param {aria.core.CfgBeans:Callback} callback Called after the submodules are initialized
[ "Load", "a", "list", "of", "page", "sub", "modules", ".", "These", "modules", "exists", "only", "in", "this", "page", "and", "should", "be", "loaded", "and", "initialized", "connecting", "their", "datamodel", "to", "the", "defined", "bindings" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L204-L245
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (args) { var modules = args.modules; for (var i = 0; i < modules.length; i += 1) { var services = modules[i].services, refpath = modules[i].refpath, moduleInstance = this._utils.resolvePath(refpath, this); if (services) { for (var service in services) { if (services.hasOwnProperty(service) && !this.json.isMetadata(service)) { if (this.services[service]) { this.$logWarn(this.SERVICE_ALREADY_DEFINED, service); } if (ariaUtilsType.isFunction(moduleInstance[services[service]])) { this.services[service] = ariaUtilsFunction.bind(moduleInstance[services[service]], moduleInstance); if (this._serviceList[refpath]) { this._serviceList[refpath].push(service); } else { this._serviceList[refpath] = [service]; } } else { this.$logError(this.SERVICE_METHOD_NOT_FOUND, [services[service], moduleInstance.$classpath]); } } } } } this.connectBindings(args); }
javascript
function (args) { var modules = args.modules; for (var i = 0; i < modules.length; i += 1) { var services = modules[i].services, refpath = modules[i].refpath, moduleInstance = this._utils.resolvePath(refpath, this); if (services) { for (var service in services) { if (services.hasOwnProperty(service) && !this.json.isMetadata(service)) { if (this.services[service]) { this.$logWarn(this.SERVICE_ALREADY_DEFINED, service); } if (ariaUtilsType.isFunction(moduleInstance[services[service]])) { this.services[service] = ariaUtilsFunction.bind(moduleInstance[services[service]], moduleInstance); if (this._serviceList[refpath]) { this._serviceList[refpath].push(service); } else { this._serviceList[refpath] = [service]; } } else { this.$logError(this.SERVICE_METHOD_NOT_FOUND, [services[service], moduleInstance.$classpath]); } } } } } this.connectBindings(args); }
[ "function", "(", "args", ")", "{", "var", "modules", "=", "args", ".", "modules", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "modules", ".", "length", ";", "i", "+=", "1", ")", "{", "var", "services", "=", "modules", "[", "i", "]", ".", "services", ",", "refpath", "=", "modules", "[", "i", "]", ".", "refpath", ",", "moduleInstance", "=", "this", ".", "_utils", ".", "resolvePath", "(", "refpath", ",", "this", ")", ";", "if", "(", "services", ")", "{", "for", "(", "var", "service", "in", "services", ")", "{", "if", "(", "services", ".", "hasOwnProperty", "(", "service", ")", "&&", "!", "this", ".", "json", ".", "isMetadata", "(", "service", ")", ")", "{", "if", "(", "this", ".", "services", "[", "service", "]", ")", "{", "this", ".", "$logWarn", "(", "this", ".", "SERVICE_ALREADY_DEFINED", ",", "service", ")", ";", "}", "if", "(", "ariaUtilsType", ".", "isFunction", "(", "moduleInstance", "[", "services", "[", "service", "]", "]", ")", ")", "{", "this", ".", "services", "[", "service", "]", "=", "ariaUtilsFunction", ".", "bind", "(", "moduleInstance", "[", "services", "[", "service", "]", "]", ",", "moduleInstance", ")", ";", "if", "(", "this", ".", "_serviceList", "[", "refpath", "]", ")", "{", "this", ".", "_serviceList", "[", "refpath", "]", ".", "push", "(", "service", ")", ";", "}", "else", "{", "this", ".", "_serviceList", "[", "refpath", "]", "=", "[", "service", "]", ";", "}", "}", "else", "{", "this", ".", "$logError", "(", "this", ".", "SERVICE_METHOD_NOT_FOUND", ",", "[", "services", "[", "service", "]", ",", "moduleInstance", ".", "$classpath", "]", ")", ";", "}", "}", "}", "}", "}", "this", ".", "connectBindings", "(", "args", ")", ";", "}" ]
Exposes methods of module controllers as services @param {Object} args
[ "Exposes", "methods", "of", "module", "controllers", "as", "services" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L251-L277
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (modRefpaths) { var refpath; for (var i = 0, len = modRefpaths.length; i < len; i++) { refpath = modRefpaths[i]; this._disconnectModuleBindings(refpath); this.disposeSubModule(this._utils.resolvePath(refpath, this)); if (this._serviceList[refpath]) { for (var i = 0; i < this._serviceList[refpath].length; i++) { delete this.services[this._serviceList[refpath][i]]; } delete this._serviceList[refpath]; } } }
javascript
function (modRefpaths) { var refpath; for (var i = 0, len = modRefpaths.length; i < len; i++) { refpath = modRefpaths[i]; this._disconnectModuleBindings(refpath); this.disposeSubModule(this._utils.resolvePath(refpath, this)); if (this._serviceList[refpath]) { for (var i = 0; i < this._serviceList[refpath].length; i++) { delete this.services[this._serviceList[refpath][i]]; } delete this._serviceList[refpath]; } } }
[ "function", "(", "modRefpaths", ")", "{", "var", "refpath", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "modRefpaths", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "refpath", "=", "modRefpaths", "[", "i", "]", ";", "this", ".", "_disconnectModuleBindings", "(", "refpath", ")", ";", "this", ".", "disposeSubModule", "(", "this", ".", "_utils", ".", "resolvePath", "(", "refpath", ",", "this", ")", ")", ";", "if", "(", "this", ".", "_serviceList", "[", "refpath", "]", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_serviceList", "[", "refpath", "]", ".", "length", ";", "i", "++", ")", "{", "delete", "this", ".", "services", "[", "this", ".", "_serviceList", "[", "refpath", "]", "[", "i", "]", "]", ";", "}", "delete", "this", ".", "_serviceList", "[", "refpath", "]", ";", "}", "}", "}" ]
Unload modules whose refpath in is modRefpaths and disconnects the related bindings @param {Array} modRefpaths refpaths of the modules to unload
[ "Unload", "modules", "whose", "refpath", "in", "is", "modRefpaths", "and", "disconnects", "the", "related", "bindings" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L289-L302
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (pageId) { var modRefpaths = (pageId && this._modulesPaths.page[pageId]) ? this._modulesPaths.page[pageId] : []; this._unloadModules(modRefpaths); delete this._modulesPaths.page[pageId]; }
javascript
function (pageId) { var modRefpaths = (pageId && this._modulesPaths.page[pageId]) ? this._modulesPaths.page[pageId] : []; this._unloadModules(modRefpaths); delete this._modulesPaths.page[pageId]; }
[ "function", "(", "pageId", ")", "{", "var", "modRefpaths", "=", "(", "pageId", "&&", "this", ".", "_modulesPaths", ".", "page", "[", "pageId", "]", ")", "?", "this", ".", "_modulesPaths", ".", "page", "[", "pageId", "]", ":", "[", "]", ";", "this", ".", "_unloadModules", "(", "modRefpaths", ")", ";", "delete", "this", ".", "_modulesPaths", ".", "page", "[", "pageId", "]", ";", "}" ]
Unload all the modules of a specific page @param {String} pageId
[ "Unload", "all", "the", "modules", "of", "a", "specific", "page" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L317-L321
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function () { this.unloadCommonModules(); var pageModRefpaths = this._modulesPaths.page; for (var pageId in pageModRefpaths) { if (pageModRefpaths.hasOwnProperty(pageId)) { this.unloadPageModules(pageId); } } }
javascript
function () { this.unloadCommonModules(); var pageModRefpaths = this._modulesPaths.page; for (var pageId in pageModRefpaths) { if (pageModRefpaths.hasOwnProperty(pageId)) { this.unloadPageModules(pageId); } } }
[ "function", "(", ")", "{", "this", ".", "unloadCommonModules", "(", ")", ";", "var", "pageModRefpaths", "=", "this", ".", "_modulesPaths", ".", "page", ";", "for", "(", "var", "pageId", "in", "pageModRefpaths", ")", "{", "if", "(", "pageModRefpaths", ".", "hasOwnProperty", "(", "pageId", ")", ")", "{", "this", ".", "unloadPageModules", "(", "pageId", ")", ";", "}", "}", "}" ]
Unload both common and page-specific modules
[ "Unload", "both", "common", "and", "page", "-", "specific", "modules" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L326-L334
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (pageId, isCommon, refpath) { var modulesPath = this._modulesPaths; if (isCommon) { modulesPath.common.push(refpath); return; } modulesPath.page[pageId] = modulesPath.page[pageId] || []; modulesPath.page[pageId].push(refpath); }
javascript
function (pageId, isCommon, refpath) { var modulesPath = this._modulesPaths; if (isCommon) { modulesPath.common.push(refpath); return; } modulesPath.page[pageId] = modulesPath.page[pageId] || []; modulesPath.page[pageId].push(refpath); }
[ "function", "(", "pageId", ",", "isCommon", ",", "refpath", ")", "{", "var", "modulesPath", "=", "this", ".", "_modulesPaths", ";", "if", "(", "isCommon", ")", "{", "modulesPath", ".", "common", ".", "push", "(", "refpath", ")", ";", "return", ";", "}", "modulesPath", ".", "page", "[", "pageId", "]", "=", "modulesPath", ".", "page", "[", "pageId", "]", "||", "[", "]", ";", "modulesPath", ".", "page", "[", "pageId", "]", ".", "push", "(", "refpath", ")", ";", "}" ]
Store the refpath @param {String} pageId @param {Boolean} isCommon @param {String} refpath
[ "Store", "the", "refpath" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L342-L350
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (refpath) { var bindings = this._bindings[refpath]; if (bindings) { for (var bind in bindings) { if (bindings.hasOwnProperty(bind)) { var moduleDescription = this._getModuleDataDescription(refpath, bind); this.json.removeListener(moduleDescription.container, moduleDescription.property, bindings[bind][1], true); } } delete this._bindings[refpath]; } }
javascript
function (refpath) { var bindings = this._bindings[refpath]; if (bindings) { for (var bind in bindings) { if (bindings.hasOwnProperty(bind)) { var moduleDescription = this._getModuleDataDescription(refpath, bind); this.json.removeListener(moduleDescription.container, moduleDescription.property, bindings[bind][1], true); } } delete this._bindings[refpath]; } }
[ "function", "(", "refpath", ")", "{", "var", "bindings", "=", "this", ".", "_bindings", "[", "refpath", "]", ";", "if", "(", "bindings", ")", "{", "for", "(", "var", "bind", "in", "bindings", ")", "{", "if", "(", "bindings", ".", "hasOwnProperty", "(", "bind", ")", ")", "{", "var", "moduleDescription", "=", "this", ".", "_getModuleDataDescription", "(", "refpath", ",", "bind", ")", ";", "this", ".", "json", ".", "removeListener", "(", "moduleDescription", ".", "container", ",", "moduleDescription", ".", "property", ",", "bindings", "[", "bind", "]", "[", "1", "]", ",", "true", ")", ";", "}", "}", "delete", "this", ".", "_bindings", "[", "refpath", "]", ";", "}", "}" ]
Remove the listener on the module data model and unregisters the binding @param {String} refpath @private
[ "Remove", "the", "listener", "on", "the", "module", "data", "model", "and", "unregisters", "the", "binding" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L416-L427
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function () { var bindings = this._bindings; for (var refpath in bindings) { if (bindings.hasOwnProperty(refpath)) { var moduleBindings = bindings[refpath]; for (var bind in moduleBindings) { if (moduleBindings.hasOwnProperty(bind)) { var moduleDataDescription = this._getModuleDataDescription(refpath, bind); var location = this._getStorage(moduleBindings[bind][0]); var storedValue = this._utils.resolvePath(location.path, location.storage); this.json.setValue(moduleDataDescription.container, moduleDataDescription.property, storedValue, moduleBindings[bind][1]); } } } } }
javascript
function () { var bindings = this._bindings; for (var refpath in bindings) { if (bindings.hasOwnProperty(refpath)) { var moduleBindings = bindings[refpath]; for (var bind in moduleBindings) { if (moduleBindings.hasOwnProperty(bind)) { var moduleDataDescription = this._getModuleDataDescription(refpath, bind); var location = this._getStorage(moduleBindings[bind][0]); var storedValue = this._utils.resolvePath(location.path, location.storage); this.json.setValue(moduleDataDescription.container, moduleDataDescription.property, storedValue, moduleBindings[bind][1]); } } } } }
[ "function", "(", ")", "{", "var", "bindings", "=", "this", ".", "_bindings", ";", "for", "(", "var", "refpath", "in", "bindings", ")", "{", "if", "(", "bindings", ".", "hasOwnProperty", "(", "refpath", ")", ")", "{", "var", "moduleBindings", "=", "bindings", "[", "refpath", "]", ";", "for", "(", "var", "bind", "in", "moduleBindings", ")", "{", "if", "(", "moduleBindings", ".", "hasOwnProperty", "(", "bind", ")", ")", "{", "var", "moduleDataDescription", "=", "this", ".", "_getModuleDataDescription", "(", "refpath", ",", "bind", ")", ";", "var", "location", "=", "this", ".", "_getStorage", "(", "moduleBindings", "[", "bind", "]", "[", "0", "]", ")", ";", "var", "storedValue", "=", "this", ".", "_utils", ".", "resolvePath", "(", "location", ".", "path", ",", "location", ".", "storage", ")", ";", "this", ".", "json", ".", "setValue", "(", "moduleDataDescription", ".", "container", ",", "moduleDataDescription", ".", "property", ",", "storedValue", ",", "moduleBindings", "[", "bind", "]", "[", "1", "]", ")", ";", "}", "}", "}", "}", "}" ]
Synchronize the storage data with the modules data model according to the registered bindings
[ "Synchronize", "the", "storage", "data", "with", "the", "modules", "data", "model", "according", "to", "the", "registered", "bindings" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L432-L447
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (refpath, bind) { var moduleData = this._utils.resolvePath(refpath, this._data); // If the path is not present in the module, set it to null if (!this._utils.resolvePath(bind, moduleData)) { this._pathUtils.setValue(moduleData, bind, null); } return this._pathUtils.describe(moduleData, bind); }
javascript
function (refpath, bind) { var moduleData = this._utils.resolvePath(refpath, this._data); // If the path is not present in the module, set it to null if (!this._utils.resolvePath(bind, moduleData)) { this._pathUtils.setValue(moduleData, bind, null); } return this._pathUtils.describe(moduleData, bind); }
[ "function", "(", "refpath", ",", "bind", ")", "{", "var", "moduleData", "=", "this", ".", "_utils", ".", "resolvePath", "(", "refpath", ",", "this", ".", "_data", ")", ";", "if", "(", "!", "this", ".", "_utils", ".", "resolvePath", "(", "bind", ",", "moduleData", ")", ")", "{", "this", ".", "_pathUtils", ".", "setValue", "(", "moduleData", ",", "bind", ",", "null", ")", ";", "}", "return", "this", ".", "_pathUtils", ".", "describe", "(", "moduleData", ",", "bind", ")", ";", "}" ]
Computes the description of a part of the datamodel inside a submodule. It creates the correct path if it is not defined @param {String} refpath Refpath of the module @param {String} bind Path inside the module data model @return {Object} container and property of the specified part of the data model @private
[ "Computes", "the", "description", "of", "a", "part", "of", "the", "datamodel", "inside", "a", "submodule", ".", "It", "creates", "the", "correct", "path", "if", "it", "is", "not", "defined" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L457-L464
train
ariatemplates/ariatemplates
src/aria/pageEngine/SiteRootModule.js
function (res, args) { var newValue = args.moduleDescription.container[args.moduleDescription.property]; var boundTo = args.boundTo; if (this._utils.resolvePath(boundTo.path, boundTo.storage) == null) { this._pathUtils.setValue(boundTo.storage, boundTo.path, null); } var dataDesc = this._pathUtils.describe(boundTo.storage, boundTo.path); this.json.setValue(dataDesc.container, dataDesc.property, newValue); }
javascript
function (res, args) { var newValue = args.moduleDescription.container[args.moduleDescription.property]; var boundTo = args.boundTo; if (this._utils.resolvePath(boundTo.path, boundTo.storage) == null) { this._pathUtils.setValue(boundTo.storage, boundTo.path, null); } var dataDesc = this._pathUtils.describe(boundTo.storage, boundTo.path); this.json.setValue(dataDesc.container, dataDesc.property, newValue); }
[ "function", "(", "res", ",", "args", ")", "{", "var", "newValue", "=", "args", ".", "moduleDescription", ".", "container", "[", "args", ".", "moduleDescription", ".", "property", "]", ";", "var", "boundTo", "=", "args", ".", "boundTo", ";", "if", "(", "this", ".", "_utils", ".", "resolvePath", "(", "boundTo", ".", "path", ",", "boundTo", ".", "storage", ")", "==", "null", ")", "{", "this", ".", "_pathUtils", ".", "setValue", "(", "boundTo", ".", "storage", ",", "boundTo", ".", "path", ",", "null", ")", ";", "}", "var", "dataDesc", "=", "this", ".", "_pathUtils", ".", "describe", "(", "boundTo", ".", "storage", ",", "boundTo", ".", "path", ")", ";", "this", ".", "json", ".", "setValue", "(", "dataDesc", ".", "container", ",", "dataDesc", ".", "property", ",", "newValue", ")", ";", "}" ]
Callback for a change in the page module's data model. Propagate the change to the root module's storage location @param {Object} res Description of the change given by the json utility @param {Object} args Contains the description of bindings. @private
[ "Callback", "for", "a", "change", "in", "the", "page", "module", "s", "data", "model", ".", "Propagate", "the", "change", "to", "the", "root", "module", "s", "storage", "location" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/SiteRootModule.js#L502-L510
train
ariatemplates/ariatemplates
src/aria/widgets/form/AutoComplete.js
function (event) { if (this._cfg.autoFill && event.domEvent) { // Closing the dropdown after typing is not a domEvent var value = this.controller.getDataModel().value; if (value != null) { var report = this.controller.checkDropdownValue(value); this._reactToControllerReport(report); } } }
javascript
function (event) { if (this._cfg.autoFill && event.domEvent) { // Closing the dropdown after typing is not a domEvent var value = this.controller.getDataModel().value; if (value != null) { var report = this.controller.checkDropdownValue(value); this._reactToControllerReport(report); } } }
[ "function", "(", "event", ")", "{", "if", "(", "this", ".", "_cfg", ".", "autoFill", "&&", "event", ".", "domEvent", ")", "{", "var", "value", "=", "this", ".", "controller", ".", "getDataModel", "(", ")", ".", "value", ";", "if", "(", "value", "!=", "null", ")", "{", "var", "report", "=", "this", ".", "controller", ".", "checkDropdownValue", "(", "value", ")", ";", "this", ".", "_reactToControllerReport", "(", "report", ")", ";", "}", "}", "}" ]
React to a dropdown close. If the widget is using autofill we want to select the pre-selected value in the datamodel and report it to the input field also when the user clicks away from the field instead of navigating through TAB or selecting an item from the dropdown. This function is called any time we close the dropdown, even when typing there are no results. @param {Object} event Event that triggered this callback @private
[ "React", "to", "a", "dropdown", "close", ".", "If", "the", "widget", "is", "using", "autofill", "we", "want", "to", "select", "the", "pre", "-", "selected", "value", "in", "the", "datamodel", "and", "report", "it", "to", "the", "input", "field", "also", "when", "the", "user", "clicks", "away", "from", "the", "field", "instead", "of", "navigating", "through", "TAB", "or", "selecting", "an", "item", "from", "the", "dropdown", ".", "This", "function", "is", "called", "any", "time", "we", "close", "the", "dropdown", "even", "when", "typing", "there", "are", "no", "results", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/AutoComplete.js#L217-L226
train
ariatemplates/ariatemplates
src/aria/widgets/form/AutoComplete.js
function(event, cb) { if (this._cfg.waiAria) { var field = this.getTextInputField(); var listWidget = this.controller.getListWidget(); var ariaActiveDescendant = listWidget ? listWidget.getSelectedOptionDomId() : null; if (ariaActiveDescendant != null) { field.setAttribute("aria-activedescendant", ariaActiveDescendant); } else { field.removeAttribute("aria-activedescendant"); } } if (cb) { this.$callback(cb, event); } }
javascript
function(event, cb) { if (this._cfg.waiAria) { var field = this.getTextInputField(); var listWidget = this.controller.getListWidget(); var ariaActiveDescendant = listWidget ? listWidget.getSelectedOptionDomId() : null; if (ariaActiveDescendant != null) { field.setAttribute("aria-activedescendant", ariaActiveDescendant); } else { field.removeAttribute("aria-activedescendant"); } } if (cb) { this.$callback(cb, event); } }
[ "function", "(", "event", ",", "cb", ")", "{", "if", "(", "this", ".", "_cfg", ".", "waiAria", ")", "{", "var", "field", "=", "this", ".", "getTextInputField", "(", ")", ";", "var", "listWidget", "=", "this", ".", "controller", ".", "getListWidget", "(", ")", ";", "var", "ariaActiveDescendant", "=", "listWidget", "?", "listWidget", ".", "getSelectedOptionDomId", "(", ")", ":", "null", ";", "if", "(", "ariaActiveDescendant", "!=", "null", ")", "{", "field", ".", "setAttribute", "(", "\"aria-activedescendant\"", ",", "ariaActiveDescendant", ")", ";", "}", "else", "{", "field", ".", "removeAttribute", "(", "\"aria-activedescendant\"", ")", ";", "}", "}", "if", "(", "cb", ")", "{", "this", ".", "$callback", "(", "cb", ",", "event", ")", ";", "}", "}" ]
Updates the aria-activedescendant attribute on the input DOM element. This method supposes that the popup is open. This method is registered as the onchange callback for the list widget, if accessibility is enabled. It is also called from _afterDropdownOpen.
[ "Updates", "the", "aria", "-", "activedescendant", "attribute", "on", "the", "input", "DOM", "element", ".", "This", "method", "supposes", "that", "the", "popup", "is", "open", ".", "This", "method", "is", "registered", "as", "the", "onchange", "callback", "for", "the", "list", "widget", "if", "accessibility", "is", "enabled", ".", "It", "is", "also", "called", "from", "_afterDropdownOpen", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/AutoComplete.js#L234-L248
train
ariatemplates/ariatemplates
src/aria/widgets/form/AutoComplete.js
function () { if (this._cfg.waiAria) { var field = this.getTextInputField(); field.removeAttribute("aria-owns"); var dropDownIcon = this._getDropdownIcon(); if (dropDownIcon) { dropDownIcon.setAttribute("aria-expanded", "false"); } } this.$DropDownListTrait._afterDropdownClose.apply(this, arguments); }
javascript
function () { if (this._cfg.waiAria) { var field = this.getTextInputField(); field.removeAttribute("aria-owns"); var dropDownIcon = this._getDropdownIcon(); if (dropDownIcon) { dropDownIcon.setAttribute("aria-expanded", "false"); } } this.$DropDownListTrait._afterDropdownClose.apply(this, arguments); }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_cfg", ".", "waiAria", ")", "{", "var", "field", "=", "this", ".", "getTextInputField", "(", ")", ";", "field", ".", "removeAttribute", "(", "\"aria-owns\"", ")", ";", "var", "dropDownIcon", "=", "this", ".", "_getDropdownIcon", "(", ")", ";", "if", "(", "dropDownIcon", ")", "{", "dropDownIcon", ".", "setAttribute", "(", "\"aria-expanded\"", ",", "\"false\"", ")", ";", "}", "}", "this", ".", "$DropDownListTrait", ".", "_afterDropdownClose", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
Called after the dropdown is closed. @override
[ "Called", "after", "the", "dropdown", "is", "closed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/form/AutoComplete.js#L285-L296
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (conf) { this.conf = conf; if (conf.waiAria == null) { conf.waiAria = environment.isWaiAria(); } ariaCoreJsonValidator.normalize({ json : conf, beanName : "aria.popups.Beans.PopupConf" }); if (this.modalMaskDomElement) { ariaUtilsDom.removeElement(this.modalMaskDomElement); this.modalMaskDomElement = null; } this.popupContainer = (conf.popupContainer || ViewportPopupContainer).$interface("aria.popups.container.IPopupContainer"); if (conf.modal) { this.modalMaskDomElement = this._createMaskDomElement(conf.maskCssClass); } if (this.domElement != null) { ariaUtilsDom.removeElement(this.domElement); } this.domElement = this._createDomElement(); this.setPreferredPositions(conf.preferredPositions); this.setSection(conf.section); if (!conf.center) { if (!conf.absolutePosition || conf.domReference) { this.setReference(conf.domReference); } else { this.setPositionAsReference(conf.absolutePosition); } } else { this.setPositionAsReference(this._getPosition(this._getFreeSize())); } this._ignoreClicksOn = conf.ignoreClicksOn; this._parentDialog = conf.parentDialog; }
javascript
function (conf) { this.conf = conf; if (conf.waiAria == null) { conf.waiAria = environment.isWaiAria(); } ariaCoreJsonValidator.normalize({ json : conf, beanName : "aria.popups.Beans.PopupConf" }); if (this.modalMaskDomElement) { ariaUtilsDom.removeElement(this.modalMaskDomElement); this.modalMaskDomElement = null; } this.popupContainer = (conf.popupContainer || ViewportPopupContainer).$interface("aria.popups.container.IPopupContainer"); if (conf.modal) { this.modalMaskDomElement = this._createMaskDomElement(conf.maskCssClass); } if (this.domElement != null) { ariaUtilsDom.removeElement(this.domElement); } this.domElement = this._createDomElement(); this.setPreferredPositions(conf.preferredPositions); this.setSection(conf.section); if (!conf.center) { if (!conf.absolutePosition || conf.domReference) { this.setReference(conf.domReference); } else { this.setPositionAsReference(conf.absolutePosition); } } else { this.setPositionAsReference(this._getPosition(this._getFreeSize())); } this._ignoreClicksOn = conf.ignoreClicksOn; this._parentDialog = conf.parentDialog; }
[ "function", "(", "conf", ")", "{", "this", ".", "conf", "=", "conf", ";", "if", "(", "conf", ".", "waiAria", "==", "null", ")", "{", "conf", ".", "waiAria", "=", "environment", ".", "isWaiAria", "(", ")", ";", "}", "ariaCoreJsonValidator", ".", "normalize", "(", "{", "json", ":", "conf", ",", "beanName", ":", "\"aria.popups.Beans.PopupConf\"", "}", ")", ";", "if", "(", "this", ".", "modalMaskDomElement", ")", "{", "ariaUtilsDom", ".", "removeElement", "(", "this", ".", "modalMaskDomElement", ")", ";", "this", ".", "modalMaskDomElement", "=", "null", ";", "}", "this", ".", "popupContainer", "=", "(", "conf", ".", "popupContainer", "||", "ViewportPopupContainer", ")", ".", "$interface", "(", "\"aria.popups.container.IPopupContainer\"", ")", ";", "if", "(", "conf", ".", "modal", ")", "{", "this", ".", "modalMaskDomElement", "=", "this", ".", "_createMaskDomElement", "(", "conf", ".", "maskCssClass", ")", ";", "}", "if", "(", "this", ".", "domElement", "!=", "null", ")", "{", "ariaUtilsDom", ".", "removeElement", "(", "this", ".", "domElement", ")", ";", "}", "this", ".", "domElement", "=", "this", ".", "_createDomElement", "(", ")", ";", "this", ".", "setPreferredPositions", "(", "conf", ".", "preferredPositions", ")", ";", "this", ".", "setSection", "(", "conf", ".", "section", ")", ";", "if", "(", "!", "conf", ".", "center", ")", "{", "if", "(", "!", "conf", ".", "absolutePosition", "||", "conf", ".", "domReference", ")", "{", "this", ".", "setReference", "(", "conf", ".", "domReference", ")", ";", "}", "else", "{", "this", ".", "setPositionAsReference", "(", "conf", ".", "absolutePosition", ")", ";", "}", "}", "else", "{", "this", ".", "setPositionAsReference", "(", "this", ".", "_getPosition", "(", "this", ".", "_getFreeSize", "(", ")", ")", ")", ";", "}", "this", ".", "_ignoreClicksOn", "=", "conf", ".", "ignoreClicksOn", ";", "this", ".", "_parentDialog", "=", "conf", ".", "parentDialog", ";", "}" ]
Save the configuration information for this popup. @param {aria.popups.Beans:PopupCfg} conf @protected
[ "Save", "the", "configuration", "information", "for", "this", "popup", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L249-L292
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function () { var document = this._document; var cfg = this.conf; var div = document.createElement("div"); div.style.cssText = "position:absolute;top:-15000px;left:-15000px;"; document.body.appendChild(div); var html = [ "<div ", ariaUtilsDelegate.getMarkup(this._delegateId), ' style="position:absolute;top:-15000px;left:-15000px;visibility:hidden;display:block;"' ]; if (cfg.waiAria) { var role = cfg.role; if (role) { role = ariaUtilsString.escapeForHTML(role, {attr: true}); html.push(' role="' + role + '"'); } var labelId = cfg.labelId; if (labelId) { labelId = ariaUtilsString.escapeForHTML(labelId, {attr: true}); html.push(' aria-labelledby="' + labelId + '"'); } } html.push("></div>"); div.innerHTML = html.join(''); var domElement = div.firstChild; document.body.removeChild(div); return this.popupContainer.getContainerElt().appendChild(domElement); }
javascript
function () { var document = this._document; var cfg = this.conf; var div = document.createElement("div"); div.style.cssText = "position:absolute;top:-15000px;left:-15000px;"; document.body.appendChild(div); var html = [ "<div ", ariaUtilsDelegate.getMarkup(this._delegateId), ' style="position:absolute;top:-15000px;left:-15000px;visibility:hidden;display:block;"' ]; if (cfg.waiAria) { var role = cfg.role; if (role) { role = ariaUtilsString.escapeForHTML(role, {attr: true}); html.push(' role="' + role + '"'); } var labelId = cfg.labelId; if (labelId) { labelId = ariaUtilsString.escapeForHTML(labelId, {attr: true}); html.push(' aria-labelledby="' + labelId + '"'); } } html.push("></div>"); div.innerHTML = html.join(''); var domElement = div.firstChild; document.body.removeChild(div); return this.popupContainer.getContainerElt().appendChild(domElement); }
[ "function", "(", ")", "{", "var", "document", "=", "this", ".", "_document", ";", "var", "cfg", "=", "this", ".", "conf", ";", "var", "div", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "div", ".", "style", ".", "cssText", "=", "\"position:absolute;top:-15000px;left:-15000px;\"", ";", "document", ".", "body", ".", "appendChild", "(", "div", ")", ";", "var", "html", "=", "[", "\"<div \"", ",", "ariaUtilsDelegate", ".", "getMarkup", "(", "this", ".", "_delegateId", ")", ",", "' style=\"position:absolute;top:-15000px;left:-15000px;visibility:hidden;display:block;\"'", "]", ";", "if", "(", "cfg", ".", "waiAria", ")", "{", "var", "role", "=", "cfg", ".", "role", ";", "if", "(", "role", ")", "{", "role", "=", "ariaUtilsString", ".", "escapeForHTML", "(", "role", ",", "{", "attr", ":", "true", "}", ")", ";", "html", ".", "push", "(", "' role=\"'", "+", "role", "+", "'\"'", ")", ";", "}", "var", "labelId", "=", "cfg", ".", "labelId", ";", "if", "(", "labelId", ")", "{", "labelId", "=", "ariaUtilsString", ".", "escapeForHTML", "(", "labelId", ",", "{", "attr", ":", "true", "}", ")", ";", "html", ".", "push", "(", "' aria-labelledby=\"'", "+", "labelId", "+", "'\"'", ")", ";", "}", "}", "html", ".", "push", "(", "\"></div>\"", ")", ";", "div", ".", "innerHTML", "=", "html", ".", "join", "(", "''", ")", ";", "var", "domElement", "=", "div", ".", "firstChild", ";", "document", ".", "body", ".", "removeChild", "(", "div", ")", ";", "return", "this", ".", "popupContainer", ".", "getContainerElt", "(", ")", ".", "appendChild", "(", "domElement", ")", ";", "}" ]
Create the DOM element of the popup, which will be used as the container @protected @return {HTMLElement} The DOM element created for this popup
[ "Create", "the", "DOM", "element", "of", "the", "popup", "which", "will", "be", "used", "as", "the", "container" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L323-L355
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (className) { var document = this._document; var div = document.createElement("div"); div.className = className || "xModalMask-default"; div.style.cssText = "position:absolute;top:-15000px;left:-15000px;visibility:hidden;display:block;"; return this.popupContainer.getContainerElt().appendChild(div); }
javascript
function (className) { var document = this._document; var div = document.createElement("div"); div.className = className || "xModalMask-default"; div.style.cssText = "position:absolute;top:-15000px;left:-15000px;visibility:hidden;display:block;"; return this.popupContainer.getContainerElt().appendChild(div); }
[ "function", "(", "className", ")", "{", "var", "document", "=", "this", ".", "_document", ";", "var", "div", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "div", ".", "className", "=", "className", "||", "\"xModalMask-default\"", ";", "div", ".", "style", ".", "cssText", "=", "\"position:absolute;top:-15000px;left:-15000px;visibility:hidden;display:block;\"", ";", "return", "this", ".", "popupContainer", ".", "getContainerElt", "(", ")", ".", "appendChild", "(", "div", ")", ";", "}" ]
Create the DOM element of the mask, for modal popups. @protected @param {String} className CSS classes for the dialog mask. @return {HTMLElement}
[ "Create", "the", "DOM", "element", "of", "the", "mask", "for", "modal", "popups", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L363-L369
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (size) { var position, isInViewSet; if (this.conf.maximized) { var offset = this.conf.offset; var containerScroll = this.popupContainer.getContainerScroll(); position = { top : containerScroll.scrollTop - offset.top, left : containerScroll.scrollLeft - offset.left }; } else if (this.conf.center) { // apply the offset (both left and right, and also top and bottom) // before centering the whole thing in the container var offset = this.conf.offset; var newSize = { width : size.width + offset.left + offset.right, height : size.height + offset.top + offset.bottom }; position = this.popupContainer.centerInside(newSize, this.reference); position = this.popupContainer.fitInside(position, newSize, this.reference); } else { var i = 0, preferredPosition; do { preferredPosition = this.preferredPositions[i]; // Calculate position for a given anchor position = this._getPositionForAnchor(preferredPosition, size); // If this position+size is out of the container, try the // next anchor available isInViewSet = this.popupContainer.isInside(position, size); i++; } while (!isInViewSet && this.preferredPositions[i]); var positionEvent = { name : "onPositioned" }; // If all anchors setting were out of the container, fallback if (!isInViewSet) { // Currently simply fallback to first anchor ... position = this._getPositionForAnchor(this.preferredPositions[0], size); position = this.popupContainer.fitInside(position, size); } else { positionEvent.position = this.preferredPositions[i - 1]; } this.$raiseEvent(positionEvent); } return position; }
javascript
function (size) { var position, isInViewSet; if (this.conf.maximized) { var offset = this.conf.offset; var containerScroll = this.popupContainer.getContainerScroll(); position = { top : containerScroll.scrollTop - offset.top, left : containerScroll.scrollLeft - offset.left }; } else if (this.conf.center) { // apply the offset (both left and right, and also top and bottom) // before centering the whole thing in the container var offset = this.conf.offset; var newSize = { width : size.width + offset.left + offset.right, height : size.height + offset.top + offset.bottom }; position = this.popupContainer.centerInside(newSize, this.reference); position = this.popupContainer.fitInside(position, newSize, this.reference); } else { var i = 0, preferredPosition; do { preferredPosition = this.preferredPositions[i]; // Calculate position for a given anchor position = this._getPositionForAnchor(preferredPosition, size); // If this position+size is out of the container, try the // next anchor available isInViewSet = this.popupContainer.isInside(position, size); i++; } while (!isInViewSet && this.preferredPositions[i]); var positionEvent = { name : "onPositioned" }; // If all anchors setting were out of the container, fallback if (!isInViewSet) { // Currently simply fallback to first anchor ... position = this._getPositionForAnchor(this.preferredPositions[0], size); position = this.popupContainer.fitInside(position, size); } else { positionEvent.position = this.preferredPositions[i - 1]; } this.$raiseEvent(positionEvent); } return position; }
[ "function", "(", "size", ")", "{", "var", "position", ",", "isInViewSet", ";", "if", "(", "this", ".", "conf", ".", "maximized", ")", "{", "var", "offset", "=", "this", ".", "conf", ".", "offset", ";", "var", "containerScroll", "=", "this", ".", "popupContainer", ".", "getContainerScroll", "(", ")", ";", "position", "=", "{", "top", ":", "containerScroll", ".", "scrollTop", "-", "offset", ".", "top", ",", "left", ":", "containerScroll", ".", "scrollLeft", "-", "offset", ".", "left", "}", ";", "}", "else", "if", "(", "this", ".", "conf", ".", "center", ")", "{", "var", "offset", "=", "this", ".", "conf", ".", "offset", ";", "var", "newSize", "=", "{", "width", ":", "size", ".", "width", "+", "offset", ".", "left", "+", "offset", ".", "right", ",", "height", ":", "size", ".", "height", "+", "offset", ".", "top", "+", "offset", ".", "bottom", "}", ";", "position", "=", "this", ".", "popupContainer", ".", "centerInside", "(", "newSize", ",", "this", ".", "reference", ")", ";", "position", "=", "this", ".", "popupContainer", ".", "fitInside", "(", "position", ",", "newSize", ",", "this", ".", "reference", ")", ";", "}", "else", "{", "var", "i", "=", "0", ",", "preferredPosition", ";", "do", "{", "preferredPosition", "=", "this", ".", "preferredPositions", "[", "i", "]", ";", "position", "=", "this", ".", "_getPositionForAnchor", "(", "preferredPosition", ",", "size", ")", ";", "isInViewSet", "=", "this", ".", "popupContainer", ".", "isInside", "(", "position", ",", "size", ")", ";", "i", "++", ";", "}", "while", "(", "!", "isInViewSet", "&&", "this", ".", "preferredPositions", "[", "i", "]", ")", ";", "var", "positionEvent", "=", "{", "name", ":", "\"onPositioned\"", "}", ";", "if", "(", "!", "isInViewSet", ")", "{", "position", "=", "this", ".", "_getPositionForAnchor", "(", "this", ".", "preferredPositions", "[", "0", "]", ",", "size", ")", ";", "position", "=", "this", ".", "popupContainer", ".", "fitInside", "(", "position", ",", "size", ")", ";", "}", "else", "{", "positionEvent", ".", "position", "=", "this", ".", "preferredPositions", "[", "i", "-", "1", "]", ";", "}", "this", ".", "$raiseEvent", "(", "positionEvent", ")", ";", "}", "return", "position", ";", "}" ]
Retrieve the absolute position of the popup on the page The position is calculated from the popup's size and configuration @param {aria.popups.Beans:Size} size The computed size of the popup @return {aria.popups.Beans:Position} The absolute position where the popup should be displayed @protected
[ "Retrieve", "the", "absolute", "position", "of", "the", "popup", "on", "the", "page", "The", "position", "is", "calculated", "from", "the", "popup", "s", "size", "and", "configuration" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L489-L535
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function () { if (!this.domElement) { return; } if (this.conf.animateOut) { this._startAnimation(this.conf.animateOut, { from : this.domElement, type : 1 }, true); } else { this.domElement.style.cssText = "position:absolute;display:none;overflow:auto;"; } if (this.modalMaskDomElement) { // if there was was an animation defined we need to fade out the background for model popups if (this.conf.animateIn) { this._getMaskAnimator().start("fade reverse", { from : this.modalMaskDomElement, type : 1 }); } else { this.modalMaskDomElement.style.cssText = "position:absolute;display:none"; } if (this._containerOverflow != -1) { this.popupContainer.changeContainerOverflow(this._containerOverflow); this._containerOverflow = -1; } } }
javascript
function () { if (!this.domElement) { return; } if (this.conf.animateOut) { this._startAnimation(this.conf.animateOut, { from : this.domElement, type : 1 }, true); } else { this.domElement.style.cssText = "position:absolute;display:none;overflow:auto;"; } if (this.modalMaskDomElement) { // if there was was an animation defined we need to fade out the background for model popups if (this.conf.animateIn) { this._getMaskAnimator().start("fade reverse", { from : this.modalMaskDomElement, type : 1 }); } else { this.modalMaskDomElement.style.cssText = "position:absolute;display:none"; } if (this._containerOverflow != -1) { this.popupContainer.changeContainerOverflow(this._containerOverflow); this._containerOverflow = -1; } } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "domElement", ")", "{", "return", ";", "}", "if", "(", "this", ".", "conf", ".", "animateOut", ")", "{", "this", ".", "_startAnimation", "(", "this", ".", "conf", ".", "animateOut", ",", "{", "from", ":", "this", ".", "domElement", ",", "type", ":", "1", "}", ",", "true", ")", ";", "}", "else", "{", "this", ".", "domElement", ".", "style", ".", "cssText", "=", "\"position:absolute;display:none;overflow:auto;\"", ";", "}", "if", "(", "this", ".", "modalMaskDomElement", ")", "{", "if", "(", "this", ".", "conf", ".", "animateIn", ")", "{", "this", ".", "_getMaskAnimator", "(", ")", ".", "start", "(", "\"fade reverse\"", ",", "{", "from", ":", "this", ".", "modalMaskDomElement", ",", "type", ":", "1", "}", ")", ";", "}", "else", "{", "this", ".", "modalMaskDomElement", ".", "style", ".", "cssText", "=", "\"position:absolute;display:none\"", ";", "}", "if", "(", "this", ".", "_containerOverflow", "!=", "-", "1", ")", "{", "this", ".", "popupContainer", ".", "changeContainerOverflow", "(", "this", ".", "_containerOverflow", ")", ";", "this", ".", "_containerOverflow", "=", "-", "1", ";", "}", "}", "}" ]
Hide the popup and the modal mask. The popup is not removed from the DOM, neither disposed. @protected
[ "Hide", "the", "popup", "and", "the", "modal", "mask", ".", "The", "popup", "is", "not", "removed", "from", "the", "DOM", "neither", "disposed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L635-L666
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (conf) { if (conf) { if ("center" in conf) { this.conf.center = conf.center; } if ("absolutePosition" in conf) { this.setPositionAsReference(conf.absolutePosition); } } this.refresh(); this.refreshProcessingIndicators(); }
javascript
function (conf) { if (conf) { if ("center" in conf) { this.conf.center = conf.center; } if ("absolutePosition" in conf) { this.setPositionAsReference(conf.absolutePosition); } } this.refresh(); this.refreshProcessingIndicators(); }
[ "function", "(", "conf", ")", "{", "if", "(", "conf", ")", "{", "if", "(", "\"center\"", "in", "conf", ")", "{", "this", ".", "conf", ".", "center", "=", "conf", ".", "center", ";", "}", "if", "(", "\"absolutePosition\"", "in", "conf", ")", "{", "this", ".", "setPositionAsReference", "(", "conf", ".", "absolutePosition", ")", ";", "}", "}", "this", ".", "refresh", "(", ")", ";", "this", ".", "refreshProcessingIndicators", "(", ")", ";", "}" ]
Set absolute position of the popup and refresh it. Refresh also processing indicators that might be displayed on top of it @param {aria.utils.DomBeans:Position} absolutePosition
[ "Set", "absolute", "position", "of", "the", "popup", "and", "refresh", "it", ".", "Refresh", "also", "processing", "indicators", "that", "might", "be", "displayed", "on", "top", "of", "it" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L835-L846
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (domEvent) { if (this.conf.closeOnMouseClick) { var event = { name : "onMouseClickClose", cancelClose : false, domEvent : domEvent }; this.$raiseEvent(event); // timeout needed by IE for the PTR07394450 : it allows the browser to move the focus (asynchronous in // IE), before to close the popup if (ariaCoreBrowser.isIE) { var that = this; setTimeout(function () { that.close(domEvent); }, 1); } else { this.close(domEvent); } return true; } }
javascript
function (domEvent) { if (this.conf.closeOnMouseClick) { var event = { name : "onMouseClickClose", cancelClose : false, domEvent : domEvent }; this.$raiseEvent(event); // timeout needed by IE for the PTR07394450 : it allows the browser to move the focus (asynchronous in // IE), before to close the popup if (ariaCoreBrowser.isIE) { var that = this; setTimeout(function () { that.close(domEvent); }, 1); } else { this.close(domEvent); } return true; } }
[ "function", "(", "domEvent", ")", "{", "if", "(", "this", ".", "conf", ".", "closeOnMouseClick", ")", "{", "var", "event", "=", "{", "name", ":", "\"onMouseClickClose\"", ",", "cancelClose", ":", "false", ",", "domEvent", ":", "domEvent", "}", ";", "this", ".", "$raiseEvent", "(", "event", ")", ";", "if", "(", "ariaCoreBrowser", ".", "isIE", ")", "{", "var", "that", "=", "this", ";", "setTimeout", "(", "function", "(", ")", "{", "that", ".", "close", "(", "domEvent", ")", ";", "}", ",", "1", ")", ";", "}", "else", "{", "this", ".", "close", "(", "domEvent", ")", ";", "}", "return", "true", ";", "}", "}" ]
Close triggered by a mouse click, coming from the popup manager Close the popup according to the configuration @param {aria.DomEvent} domEvent event that triggered the closing of the popup
[ "Close", "triggered", "by", "a", "mouse", "click", "coming", "from", "the", "popup", "manager", "Close", "the", "popup", "according", "to", "the", "configuration" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L911-L932
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (domEvent) { if (this.conf.closeOnMouseOut) { if (!this.conf.closeOnMouseOutDelay) { // If delay is not set // OR is equal to zero this.close(domEvent); } else { this.cancelMouseOutTimer(); this._mouseOutTimer = ariaCoreTimer.addCallback({ fn : this._onMouseOutTimeout, scope : this, delay : this.conf.closeOnMouseOutDelay }); this._attachMouseOverListener(); } } }
javascript
function (domEvent) { if (this.conf.closeOnMouseOut) { if (!this.conf.closeOnMouseOutDelay) { // If delay is not set // OR is equal to zero this.close(domEvent); } else { this.cancelMouseOutTimer(); this._mouseOutTimer = ariaCoreTimer.addCallback({ fn : this._onMouseOutTimeout, scope : this, delay : this.conf.closeOnMouseOutDelay }); this._attachMouseOverListener(); } } }
[ "function", "(", "domEvent", ")", "{", "if", "(", "this", ".", "conf", ".", "closeOnMouseOut", ")", "{", "if", "(", "!", "this", ".", "conf", ".", "closeOnMouseOutDelay", ")", "{", "this", ".", "close", "(", "domEvent", ")", ";", "}", "else", "{", "this", ".", "cancelMouseOutTimer", "(", ")", ";", "this", ".", "_mouseOutTimer", "=", "ariaCoreTimer", ".", "addCallback", "(", "{", "fn", ":", "this", ".", "_onMouseOutTimeout", ",", "scope", ":", "this", ",", "delay", ":", "this", ".", "conf", ".", "closeOnMouseOutDelay", "}", ")", ";", "this", ".", "_attachMouseOverListener", "(", ")", ";", "}", "}", "}" ]
Close triggered by a mouse out event, coming from the popup manager Close the popup according to the configuration @param {aria.DomEvent} event mouseout event that triggered the action
[ "Close", "triggered", "by", "a", "mouse", "out", "event", "coming", "from", "the", "popup", "manager", "Close", "the", "popup", "according", "to", "the", "configuration" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L939-L955
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (element) { var size = ariaUtilsSize.getSize(element), domUtil = ariaUtilsDom; domUtil.scrollIntoView(element); var position = this.popupContainer.calculatePosition(element); this.reference = element; this.referencePosition = position; this.referenceSize = size; }
javascript
function (element) { var size = ariaUtilsSize.getSize(element), domUtil = ariaUtilsDom; domUtil.scrollIntoView(element); var position = this.popupContainer.calculatePosition(element); this.reference = element; this.referencePosition = position; this.referenceSize = size; }
[ "function", "(", "element", ")", "{", "var", "size", "=", "ariaUtilsSize", ".", "getSize", "(", "element", ")", ",", "domUtil", "=", "ariaUtilsDom", ";", "domUtil", ".", "scrollIntoView", "(", "element", ")", ";", "var", "position", "=", "this", ".", "popupContainer", ".", "calculatePosition", "(", "element", ")", ";", "this", ".", "reference", "=", "element", ";", "this", ".", "referencePosition", "=", "position", ";", "this", ".", "referenceSize", "=", "size", ";", "}" ]
Set the given HTML element as the reference which will be used to position the popup. Calculate the position and size of the element @param {HTMLElement} element Element which will be used as a reference to position the popup
[ "Set", "the", "given", "HTML", "element", "as", "the", "reference", "which", "will", "be", "used", "to", "position", "the", "popup", ".", "Calculate", "the", "position", "and", "size", "of", "the", "element" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L1073-L1081
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (section) { // PROFILING // var profilingId = this.$startMeasure("Inserting // section in DOM"); ariaUtilsDom.replaceHTML(this.domElement, section.html); // var sectionDomElement = this.domElement.firstChild; // Maybe the initWidget should be done after displaying the popup ? section.initWidgets(); this.section = section; // PROFILING // this.$stopMeasure(profilingId); }
javascript
function (section) { // PROFILING // var profilingId = this.$startMeasure("Inserting // section in DOM"); ariaUtilsDom.replaceHTML(this.domElement, section.html); // var sectionDomElement = this.domElement.firstChild; // Maybe the initWidget should be done after displaying the popup ? section.initWidgets(); this.section = section; // PROFILING // this.$stopMeasure(profilingId); }
[ "function", "(", "section", ")", "{", "ariaUtilsDom", ".", "replaceHTML", "(", "this", ".", "domElement", ",", "section", ".", "html", ")", ";", "section", ".", "initWidgets", "(", ")", ";", "this", ".", "section", "=", "section", ";", "}" ]
Set the section which will be used as the content of this popup Calculate its size and initialize the widgets inside it @param {aria.templates.Section} section
[ "Set", "the", "section", "which", "will", "be", "used", "as", "the", "content", "of", "this", "popup", "Calculate", "its", "size", "and", "initialize", "the", "widgets", "inside", "it" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L1088-L1100
train
ariatemplates/ariatemplates
src/aria/popups/Popup.js
function (zIndex, modalMaskZIndex) { var computedStyle = this.computedStyle; if (computedStyle) { computedStyle.zIndex = zIndex; if (modalMaskZIndex != null) { this.modalMaskZIndex = modalMaskZIndex; } this.refresh(); } }
javascript
function (zIndex, modalMaskZIndex) { var computedStyle = this.computedStyle; if (computedStyle) { computedStyle.zIndex = zIndex; if (modalMaskZIndex != null) { this.modalMaskZIndex = modalMaskZIndex; } this.refresh(); } }
[ "function", "(", "zIndex", ",", "modalMaskZIndex", ")", "{", "var", "computedStyle", "=", "this", ".", "computedStyle", ";", "if", "(", "computedStyle", ")", "{", "computedStyle", ".", "zIndex", "=", "zIndex", ";", "if", "(", "modalMaskZIndex", "!=", "null", ")", "{", "this", ".", "modalMaskZIndex", "=", "modalMaskZIndex", ";", "}", "this", ".", "refresh", "(", ")", ";", "}", "}" ]
Sets the zIndex of the popup, and refreshes. The zIndex of the modal mask, if any, is not changed, unless the second parameter is defined. This method does nothing if the popup has not already been displayed. @param {Number} zIndex zIndex to set on the popup. @param {Number} modalMaskZIndex zIndex to set on the modal mask.
[ "Sets", "the", "zIndex", "of", "the", "popup", "and", "refreshes", ".", "The", "zIndex", "of", "the", "modal", "mask", "if", "any", "is", "not", "changed", "unless", "the", "second", "parameter", "is", "defined", ".", "This", "method", "does", "nothing", "if", "the", "popup", "has", "not", "already", "been", "displayed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/popups/Popup.js#L1109-L1118
train
ariatemplates/ariatemplates
src/aria/utils/Path.js
function (path, inside) { if (ariaUtilsType.isString(path)) { path = this.parse(path); } inside = inside ? inside : Aria.$window; if (ariaUtilsType.isArray(path)) { for (var index = 0, param, len = path.length; index < len; index++) { param = path[index]; inside = inside[param]; if (!inside && index != len - 1) { throw { error : this.RESOLVE_FAIL, args : [path], object : inside }; } } return inside; } throw { error : this.RESOLVE_FAIL, args : [path], object : inside }; }
javascript
function (path, inside) { if (ariaUtilsType.isString(path)) { path = this.parse(path); } inside = inside ? inside : Aria.$window; if (ariaUtilsType.isArray(path)) { for (var index = 0, param, len = path.length; index < len; index++) { param = path[index]; inside = inside[param]; if (!inside && index != len - 1) { throw { error : this.RESOLVE_FAIL, args : [path], object : inside }; } } return inside; } throw { error : this.RESOLVE_FAIL, args : [path], object : inside }; }
[ "function", "(", "path", ",", "inside", ")", "{", "if", "(", "ariaUtilsType", ".", "isString", "(", "path", ")", ")", "{", "path", "=", "this", ".", "parse", "(", "path", ")", ";", "}", "inside", "=", "inside", "?", "inside", ":", "Aria", ".", "$window", ";", "if", "(", "ariaUtilsType", ".", "isArray", "(", "path", ")", ")", "{", "for", "(", "var", "index", "=", "0", ",", "param", ",", "len", "=", "path", ".", "length", ";", "index", "<", "len", ";", "index", "++", ")", "{", "param", "=", "path", "[", "index", "]", ";", "inside", "=", "inside", "[", "param", "]", ";", "if", "(", "!", "inside", "&&", "index", "!=", "len", "-", "1", ")", "{", "throw", "{", "error", ":", "this", ".", "RESOLVE_FAIL", ",", "args", ":", "[", "path", "]", ",", "object", ":", "inside", "}", ";", "}", "}", "return", "inside", ";", "}", "throw", "{", "error", ":", "this", ".", "RESOLVE_FAIL", ",", "args", ":", "[", "path", "]", ",", "object", ":", "inside", "}", ";", "}" ]
Resolve a path inside an object, and return result @param {String|Array} path If a string, will parse it. If Array, specifies the suite of parameters to follow. @param {Object} inside If not specified, window is used.
[ "Resolve", "a", "path", "inside", "an", "object", "and", "return", "result" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Path.js#L83-L107
train
ariatemplates/ariatemplates
src/aria/utils/Path.js
function (path) { // edge case if (!path) { return []; } // first letter will give the type var first = path.charAt(0), closing, part, next, nextParse; // case brackets if (first == "[") { closing = path.indexOf("]"); if (closing != -1) { part = path.substring(1, closing); next = path.substring(closing + 1); if (/^\d+$/.test(part)) { nextParse = this._paramParse(next); nextParse.unshift(parseInt(part, 10)); return nextParse; } else { // check that part is "something" or 'somethingelse' var strMarker = part.charAt(0), utilString = ariaUtilsString; if ((strMarker == "'" || strMarker == '"') && utilString.indexOfNotEscaped(part, strMarker, 1) == part.length - 1) { nextParse = this._paramParse(next); nextParse.unshift(part.substring(1, part.length - 1).replace(new RegExp("\\\\" + strMarker, "gi"), strMarker)); return nextParse; } } } } else if (first == ".") { part = /^[_A-z\$]\w*/.exec(path.substring(1)); if (part.length) { part = part[0]; next = path.substring(part.length + 1); nextParse = this._paramParse(next); nextParse.unshift(part); return nextParse; } } // nothing returned -> throws an exception throw { error : this.WRONG_PATH_SYNTAX, args : [path] }; }
javascript
function (path) { // edge case if (!path) { return []; } // first letter will give the type var first = path.charAt(0), closing, part, next, nextParse; // case brackets if (first == "[") { closing = path.indexOf("]"); if (closing != -1) { part = path.substring(1, closing); next = path.substring(closing + 1); if (/^\d+$/.test(part)) { nextParse = this._paramParse(next); nextParse.unshift(parseInt(part, 10)); return nextParse; } else { // check that part is "something" or 'somethingelse' var strMarker = part.charAt(0), utilString = ariaUtilsString; if ((strMarker == "'" || strMarker == '"') && utilString.indexOfNotEscaped(part, strMarker, 1) == part.length - 1) { nextParse = this._paramParse(next); nextParse.unshift(part.substring(1, part.length - 1).replace(new RegExp("\\\\" + strMarker, "gi"), strMarker)); return nextParse; } } } } else if (first == ".") { part = /^[_A-z\$]\w*/.exec(path.substring(1)); if (part.length) { part = part[0]; next = path.substring(part.length + 1); nextParse = this._paramParse(next); nextParse.unshift(part); return nextParse; } } // nothing returned -> throws an exception throw { error : this.WRONG_PATH_SYNTAX, args : [path] }; }
[ "function", "(", "path", ")", "{", "if", "(", "!", "path", ")", "{", "return", "[", "]", ";", "}", "var", "first", "=", "path", ".", "charAt", "(", "0", ")", ",", "closing", ",", "part", ",", "next", ",", "nextParse", ";", "if", "(", "first", "==", "\"[\"", ")", "{", "closing", "=", "path", ".", "indexOf", "(", "\"]\"", ")", ";", "if", "(", "closing", "!=", "-", "1", ")", "{", "part", "=", "path", ".", "substring", "(", "1", ",", "closing", ")", ";", "next", "=", "path", ".", "substring", "(", "closing", "+", "1", ")", ";", "if", "(", "/", "^\\d+$", "/", ".", "test", "(", "part", ")", ")", "{", "nextParse", "=", "this", ".", "_paramParse", "(", "next", ")", ";", "nextParse", ".", "unshift", "(", "parseInt", "(", "part", ",", "10", ")", ")", ";", "return", "nextParse", ";", "}", "else", "{", "var", "strMarker", "=", "part", ".", "charAt", "(", "0", ")", ",", "utilString", "=", "ariaUtilsString", ";", "if", "(", "(", "strMarker", "==", "\"'\"", "||", "strMarker", "==", "'\"'", ")", "&&", "utilString", ".", "indexOfNotEscaped", "(", "part", ",", "strMarker", ",", "1", ")", "==", "part", ".", "length", "-", "1", ")", "{", "nextParse", "=", "this", ".", "_paramParse", "(", "next", ")", ";", "nextParse", ".", "unshift", "(", "part", ".", "substring", "(", "1", ",", "part", ".", "length", "-", "1", ")", ".", "replace", "(", "new", "RegExp", "(", "\"\\\\\\\\\"", "+", "\\\\", ",", "\\\\", ")", ",", "strMarker", ")", ")", ";", "\"gi\"", "}", "}", "}", "}", "else", "strMarker", "return", "nextParse", ";", "}" ]
Parse parameters in path @protected @param {String} path like .param1[0]["param2"] @return {Array}
[ "Parse", "parameters", "in", "path" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Path.js#L124-L170
train
ariatemplates/ariatemplates
src/aria/utils/Path.js
function (pathParts) { var path = [pathParts[0]]; for (var index = 1, len = pathParts.length; index < len; index++) { path.push("[\"" + ("" + pathParts[index]).replace(/"/gi, '\\"') + "\"]"); } return path.join(''); }
javascript
function (pathParts) { var path = [pathParts[0]]; for (var index = 1, len = pathParts.length; index < len; index++) { path.push("[\"" + ("" + pathParts[index]).replace(/"/gi, '\\"') + "\"]"); } return path.join(''); }
[ "function", "(", "pathParts", ")", "{", "var", "path", "=", "[", "pathParts", "[", "0", "]", "]", ";", "for", "(", "var", "index", "=", "1", ",", "len", "=", "pathParts", ".", "length", ";", "index", "<", "len", ";", "index", "++", ")", "{", "path", ".", "push", "(", "\"[\\\"\"", "+", "\\\"", "+", "(", "\"\"", "+", "pathParts", "[", "index", "]", ")", ".", "replace", "(", "/", "\"", "/", "gi", ",", "'\\\\\"'", ")", ")", ";", "}", "\\\\", "}" ]
Transform an array of paths part into a path @param {Array} pathParts @return {String}
[ "Transform", "an", "array", "of", "paths", "part", "into", "a", "path" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Path.js#L177-L183
train
ariatemplates/ariatemplates
src/aria/templates/Template.js
function (evt) { if (!evt || !evt.changedProperties || ArrayUtils.contains(evt.changedProperties, "contextualMenu")) { Aria.load({ classes : ["aria.tools.contextual.ContextualMenu"] }); } }
javascript
function (evt) { if (!evt || !evt.changedProperties || ArrayUtils.contains(evt.changedProperties, "contextualMenu")) { Aria.load({ classes : ["aria.tools.contextual.ContextualMenu"] }); } }
[ "function", "(", "evt", ")", "{", "if", "(", "!", "evt", "||", "!", "evt", ".", "changedProperties", "||", "ArrayUtils", ".", "contains", "(", "evt", ".", "changedProperties", ",", "\"contextualMenu\"", ")", ")", "{", "Aria", ".", "load", "(", "{", "classes", ":", "[", "\"aria.tools.contextual.ContextualMenu\"", "]", "}", ")", ";", "}", "}" ]
This function handles environment change. When the contextual menu is enabled it loads the required classes.
[ "This", "function", "handles", "environment", "change", ".", "When", "the", "contextual", "menu", "is", "enabled", "it", "loads", "the", "required", "classes", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Template.js#L30-L36
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function (event) { var containerSize = this._popupContainer.getClientSize(); if (!this._popup.isOpen || containerSize.width <= 0 || containerSize.height <= 0) { // do nothing if the container is not visible // or if the popup was manually hidden from external code return; } var domElt = this._domElt; var maximized = this._cfg.maximized; if (domElt) { // Remove width and height, they will be recalculated later, to have the content size well calculated domElt.style.width = ""; domElt.style.height = ""; // constrain dialog to containerSize this._updateDivSize(containerSize); this._updateContainerSize(); } if (maximized) { this._setMaximizedHeightAndWidth(containerSize); } }
javascript
function (event) { var containerSize = this._popupContainer.getClientSize(); if (!this._popup.isOpen || containerSize.width <= 0 || containerSize.height <= 0) { // do nothing if the container is not visible // or if the popup was manually hidden from external code return; } var domElt = this._domElt; var maximized = this._cfg.maximized; if (domElt) { // Remove width and height, they will be recalculated later, to have the content size well calculated domElt.style.width = ""; domElt.style.height = ""; // constrain dialog to containerSize this._updateDivSize(containerSize); this._updateContainerSize(); } if (maximized) { this._setMaximizedHeightAndWidth(containerSize); } }
[ "function", "(", "event", ")", "{", "var", "containerSize", "=", "this", ".", "_popupContainer", ".", "getClientSize", "(", ")", ";", "if", "(", "!", "this", ".", "_popup", ".", "isOpen", "||", "containerSize", ".", "width", "<=", "0", "||", "containerSize", ".", "height", "<=", "0", ")", "{", "return", ";", "}", "var", "domElt", "=", "this", ".", "_domElt", ";", "var", "maximized", "=", "this", ".", "_cfg", ".", "maximized", ";", "if", "(", "domElt", ")", "{", "domElt", ".", "style", ".", "width", "=", "\"\"", ";", "domElt", ".", "style", ".", "height", "=", "\"\"", ";", "this", ".", "_updateDivSize", "(", "containerSize", ")", ";", "this", ".", "_updateContainerSize", "(", ")", ";", "}", "if", "(", "maximized", ")", "{", "this", ".", "_setMaximizedHeightAndWidth", "(", "containerSize", ")", ";", "}", "}" ]
Manage the viewport resize event @param {aria.DomEvent} event @protected
[ "Manage", "the", "viewport", "resize", "event" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L188-L212
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function (cfg) { // Note also some related operations are done beforehand, in _registerBindings if (!("macro" in cfg) && !("bind" in cfg && "macro" in cfg.bind)) { this.$logError(this.MISSING_CONTENT_MACRO); } var appEnvDialogSettings = aria.widgets.environment.WidgetSettings.getWidgetSettings().dialog; if (!("movable" in cfg)) { cfg.movable = appEnvDialogSettings.movable; } if (!("movableProxy" in cfg)) { cfg.movableProxy = appEnvDialogSettings.movableProxy; } if (cfg.autoFocus == null) { cfg.autoFocus = cfg.modal; } if (cfg.focusableTitle == null) { cfg.focusableTitle = cfg.waiAria; } if (cfg.focusableClose == null) { cfg.focusableClose = !!(cfg.waiAria && cfg.closeLabel); } if (cfg.focusableMaximize == null) { cfg.focusableMaximize = !!(cfg.waiAria && cfg.maximizeLabel); } if (cfg.titleTag == null) { cfg.titleTag = cfg.waiAria ? "h1" : "span"; } }
javascript
function (cfg) { // Note also some related operations are done beforehand, in _registerBindings if (!("macro" in cfg) && !("bind" in cfg && "macro" in cfg.bind)) { this.$logError(this.MISSING_CONTENT_MACRO); } var appEnvDialogSettings = aria.widgets.environment.WidgetSettings.getWidgetSettings().dialog; if (!("movable" in cfg)) { cfg.movable = appEnvDialogSettings.movable; } if (!("movableProxy" in cfg)) { cfg.movableProxy = appEnvDialogSettings.movableProxy; } if (cfg.autoFocus == null) { cfg.autoFocus = cfg.modal; } if (cfg.focusableTitle == null) { cfg.focusableTitle = cfg.waiAria; } if (cfg.focusableClose == null) { cfg.focusableClose = !!(cfg.waiAria && cfg.closeLabel); } if (cfg.focusableMaximize == null) { cfg.focusableMaximize = !!(cfg.waiAria && cfg.maximizeLabel); } if (cfg.titleTag == null) { cfg.titleTag = cfg.waiAria ? "h1" : "span"; } }
[ "function", "(", "cfg", ")", "{", "if", "(", "!", "(", "\"macro\"", "in", "cfg", ")", "&&", "!", "(", "\"bind\"", "in", "cfg", "&&", "\"macro\"", "in", "cfg", ".", "bind", ")", ")", "{", "this", ".", "$logError", "(", "this", ".", "MISSING_CONTENT_MACRO", ")", ";", "}", "var", "appEnvDialogSettings", "=", "aria", ".", "widgets", ".", "environment", ".", "WidgetSettings", ".", "getWidgetSettings", "(", ")", ".", "dialog", ";", "if", "(", "!", "(", "\"movable\"", "in", "cfg", ")", ")", "{", "cfg", ".", "movable", "=", "appEnvDialogSettings", ".", "movable", ";", "}", "if", "(", "!", "(", "\"movableProxy\"", "in", "cfg", ")", ")", "{", "cfg", ".", "movableProxy", "=", "appEnvDialogSettings", ".", "movableProxy", ";", "}", "if", "(", "cfg", ".", "autoFocus", "==", "null", ")", "{", "cfg", ".", "autoFocus", "=", "cfg", ".", "modal", ";", "}", "if", "(", "cfg", ".", "focusableTitle", "==", "null", ")", "{", "cfg", ".", "focusableTitle", "=", "cfg", ".", "waiAria", ";", "}", "if", "(", "cfg", ".", "focusableClose", "==", "null", ")", "{", "cfg", ".", "focusableClose", "=", "!", "!", "(", "cfg", ".", "waiAria", "&&", "cfg", ".", "closeLabel", ")", ";", "}", "if", "(", "cfg", ".", "focusableMaximize", "==", "null", ")", "{", "cfg", ".", "focusableMaximize", "=", "!", "!", "(", "cfg", ".", "waiAria", "&&", "cfg", ".", "maximizeLabel", ")", ";", "}", "if", "(", "cfg", ".", "titleTag", "==", "null", ")", "{", "cfg", ".", "titleTag", "=", "cfg", ".", "waiAria", "?", "\"h1\"", ":", "\"span\"", ";", "}", "}" ]
Check that a content macro is specified or bound to the dataModel @param {aria.widgets.CfgBeans:DialogCfg} cfg @protected
[ "Check", "that", "a", "content", "macro", "is", "specified", "or", "bound", "to", "the", "dataModel" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L219-L246
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function (out) { var cfg = this._cfg; var containerSize = this._popupContainer.getClientSize(); // constrain dialog to containerSize var math = ariaUtilsMath; var maxHeight, maxWidth; if (this._cfg.maximized) { maxHeight = containerSize.height + this._shadows.top + this._shadows.bottom; maxWidth = containerSize.width + this._shadows.left + this._shadows.right; } else { maxHeight = math.min(this._cfg.maxHeight, containerSize.height); maxWidth = math.min(this._cfg.maxWidth, containerSize.width); } if (!titleLast) { this.writeTitleBar(out); } this._div = new ariaWidgetsContainerDiv({ sclass : this._skinObj.divsclass, margins : "0 0 0 0", block : true, cssClass : this._context.getCSSClassNames(true) + " " + this._cfg.cssClass, height : this._cfg.height, minHeight : this._cfg.minHeight, maxHeight : maxHeight, width : this._cfg.width, minWidth : this._cfg.minWidth, maxWidth : maxWidth, scrollBarX : this._cfg.scrollBarX, scrollBarY : this._cfg.scrollBarY }, this._context, this._lineNumber); out.registerBehavior(this._div); this._div.writeMarkupBegin(out); out.beginSection({ id : "__dialogContent_" + this._domId, keyMap : [{ key : "ESCAPE", callback : { fn : this._onEscape, scope : this } }] }); if (this._cfg.macro) { out.callMacro(this._cfg.macro); } out.endSection(); this._div.writeMarkupEnd(out); // for resize handle markup if (cfg.resizable && this._handlesArr) { var handles = this._handlesArr; for (var i = 0, ii = handles.length; i < ii; i++) { out.write(['<span class="x', this._skinnableClass, '_resizable xDialog_' + handles[i] + '">', '</span>'].join('')); } } if (titleLast) { this.writeTitleBar(out); } }
javascript
function (out) { var cfg = this._cfg; var containerSize = this._popupContainer.getClientSize(); // constrain dialog to containerSize var math = ariaUtilsMath; var maxHeight, maxWidth; if (this._cfg.maximized) { maxHeight = containerSize.height + this._shadows.top + this._shadows.bottom; maxWidth = containerSize.width + this._shadows.left + this._shadows.right; } else { maxHeight = math.min(this._cfg.maxHeight, containerSize.height); maxWidth = math.min(this._cfg.maxWidth, containerSize.width); } if (!titleLast) { this.writeTitleBar(out); } this._div = new ariaWidgetsContainerDiv({ sclass : this._skinObj.divsclass, margins : "0 0 0 0", block : true, cssClass : this._context.getCSSClassNames(true) + " " + this._cfg.cssClass, height : this._cfg.height, minHeight : this._cfg.minHeight, maxHeight : maxHeight, width : this._cfg.width, minWidth : this._cfg.minWidth, maxWidth : maxWidth, scrollBarX : this._cfg.scrollBarX, scrollBarY : this._cfg.scrollBarY }, this._context, this._lineNumber); out.registerBehavior(this._div); this._div.writeMarkupBegin(out); out.beginSection({ id : "__dialogContent_" + this._domId, keyMap : [{ key : "ESCAPE", callback : { fn : this._onEscape, scope : this } }] }); if (this._cfg.macro) { out.callMacro(this._cfg.macro); } out.endSection(); this._div.writeMarkupEnd(out); // for resize handle markup if (cfg.resizable && this._handlesArr) { var handles = this._handlesArr; for (var i = 0, ii = handles.length; i < ii; i++) { out.write(['<span class="x', this._skinnableClass, '_resizable xDialog_' + handles[i] + '">', '</span>'].join('')); } } if (titleLast) { this.writeTitleBar(out); } }
[ "function", "(", "out", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "var", "containerSize", "=", "this", ".", "_popupContainer", ".", "getClientSize", "(", ")", ";", "var", "math", "=", "ariaUtilsMath", ";", "var", "maxHeight", ",", "maxWidth", ";", "if", "(", "this", ".", "_cfg", ".", "maximized", ")", "{", "maxHeight", "=", "containerSize", ".", "height", "+", "this", ".", "_shadows", ".", "top", "+", "this", ".", "_shadows", ".", "bottom", ";", "maxWidth", "=", "containerSize", ".", "width", "+", "this", ".", "_shadows", ".", "left", "+", "this", ".", "_shadows", ".", "right", ";", "}", "else", "{", "maxHeight", "=", "math", ".", "min", "(", "this", ".", "_cfg", ".", "maxHeight", ",", "containerSize", ".", "height", ")", ";", "maxWidth", "=", "math", ".", "min", "(", "this", ".", "_cfg", ".", "maxWidth", ",", "containerSize", ".", "width", ")", ";", "}", "if", "(", "!", "titleLast", ")", "{", "this", ".", "writeTitleBar", "(", "out", ")", ";", "}", "this", ".", "_div", "=", "new", "ariaWidgetsContainerDiv", "(", "{", "sclass", ":", "this", ".", "_skinObj", ".", "divsclass", ",", "margins", ":", "\"0 0 0 0\"", ",", "block", ":", "true", ",", "cssClass", ":", "this", ".", "_context", ".", "getCSSClassNames", "(", "true", ")", "+", "\" \"", "+", "this", ".", "_cfg", ".", "cssClass", ",", "height", ":", "this", ".", "_cfg", ".", "height", ",", "minHeight", ":", "this", ".", "_cfg", ".", "minHeight", ",", "maxHeight", ":", "maxHeight", ",", "width", ":", "this", ".", "_cfg", ".", "width", ",", "minWidth", ":", "this", ".", "_cfg", ".", "minWidth", ",", "maxWidth", ":", "maxWidth", ",", "scrollBarX", ":", "this", ".", "_cfg", ".", "scrollBarX", ",", "scrollBarY", ":", "this", ".", "_cfg", ".", "scrollBarY", "}", ",", "this", ".", "_context", ",", "this", ".", "_lineNumber", ")", ";", "out", ".", "registerBehavior", "(", "this", ".", "_div", ")", ";", "this", ".", "_div", ".", "writeMarkupBegin", "(", "out", ")", ";", "out", ".", "beginSection", "(", "{", "id", ":", "\"__dialogContent_\"", "+", "this", ".", "_domId", ",", "keyMap", ":", "[", "{", "key", ":", "\"ESCAPE\"", ",", "callback", ":", "{", "fn", ":", "this", ".", "_onEscape", ",", "scope", ":", "this", "}", "}", "]", "}", ")", ";", "if", "(", "this", ".", "_cfg", ".", "macro", ")", "{", "out", ".", "callMacro", "(", "this", ".", "_cfg", ".", "macro", ")", ";", "}", "out", ".", "endSection", "(", ")", ";", "this", ".", "_div", ".", "writeMarkupEnd", "(", "out", ")", ";", "if", "(", "cfg", ".", "resizable", "&&", "this", ".", "_handlesArr", ")", "{", "var", "handles", "=", "this", ".", "_handlesArr", ";", "for", "(", "var", "i", "=", "0", ",", "ii", "=", "handles", ".", "length", ";", "i", "<", "ii", ";", "i", "++", ")", "{", "out", ".", "write", "(", "[", "'<span class=\"x'", ",", "this", ".", "_skinnableClass", ",", "'_resizable xDialog_'", "+", "handles", "[", "i", "]", "+", "'\">'", ",", "'</span>'", "]", ".", "join", "(", "''", ")", ")", ";", "}", "}", "if", "(", "titleLast", ")", "{", "this", ".", "writeTitleBar", "(", "out", ")", ";", "}", "}" ]
Callback called when the dialog's main section is refreshed @param {aria.templates.MarkupWriter} out the writer Object to use to output markup @private
[ "Callback", "called", "when", "the", "dialog", "s", "main", "section", "is", "refreshed" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L379-L446
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function (propertyName, newValue, oldValue) { if (propertyName === "visible") { this._cfg.visible = newValue; if (newValue) { this.open(); } else { this.close(); } } else if (propertyName === "movable") { this._cfg.movable = newValue; if (this._popup && this._popup.isOpen) { if (newValue) { this._loadAndCreateDraggable(); } else { this._destroyDraggable(); } } } else if (propertyName === "title") { this._cfg.title = newValue; if (this._titleDomElt) { this._titleDomElt.innerHTML = newValue; this._onDimensionsChanged(); } } else if (propertyName === "macro") { this._cfg.macro = newValue; if (this._popup) { if (!this._popup.isOpen) { this.open(); } else { var args = { section : "__dialogContent_" + this._domId, macro : newValue }; this._context.$refresh(args); } } } else if (propertyName === "xpos" || propertyName === "ypos") { this._cfg[propertyName] = newValue; this.setProperty("center", false); this.updatePosition(); } else if (propertyName === "center") { this._cfg.center = newValue; this.updatePosition(); } else if (propertyName === "maximized") { this._toggleMaximize(newValue); } else if (propertyName === "width" || propertyName === "height") { this._onDimensionsChanged(false); } else if (propertyName === "restoreFocusOnClose") { this._cfg[propertyName] = newValue; } else { // delegate to parent class this.$Container._onBoundPropertyChange.apply(this, arguments); } }
javascript
function (propertyName, newValue, oldValue) { if (propertyName === "visible") { this._cfg.visible = newValue; if (newValue) { this.open(); } else { this.close(); } } else if (propertyName === "movable") { this._cfg.movable = newValue; if (this._popup && this._popup.isOpen) { if (newValue) { this._loadAndCreateDraggable(); } else { this._destroyDraggable(); } } } else if (propertyName === "title") { this._cfg.title = newValue; if (this._titleDomElt) { this._titleDomElt.innerHTML = newValue; this._onDimensionsChanged(); } } else if (propertyName === "macro") { this._cfg.macro = newValue; if (this._popup) { if (!this._popup.isOpen) { this.open(); } else { var args = { section : "__dialogContent_" + this._domId, macro : newValue }; this._context.$refresh(args); } } } else if (propertyName === "xpos" || propertyName === "ypos") { this._cfg[propertyName] = newValue; this.setProperty("center", false); this.updatePosition(); } else if (propertyName === "center") { this._cfg.center = newValue; this.updatePosition(); } else if (propertyName === "maximized") { this._toggleMaximize(newValue); } else if (propertyName === "width" || propertyName === "height") { this._onDimensionsChanged(false); } else if (propertyName === "restoreFocusOnClose") { this._cfg[propertyName] = newValue; } else { // delegate to parent class this.$Container._onBoundPropertyChange.apply(this, arguments); } }
[ "function", "(", "propertyName", ",", "newValue", ",", "oldValue", ")", "{", "if", "(", "propertyName", "===", "\"visible\"", ")", "{", "this", ".", "_cfg", ".", "visible", "=", "newValue", ";", "if", "(", "newValue", ")", "{", "this", ".", "open", "(", ")", ";", "}", "else", "{", "this", ".", "close", "(", ")", ";", "}", "}", "else", "if", "(", "propertyName", "===", "\"movable\"", ")", "{", "this", ".", "_cfg", ".", "movable", "=", "newValue", ";", "if", "(", "this", ".", "_popup", "&&", "this", ".", "_popup", ".", "isOpen", ")", "{", "if", "(", "newValue", ")", "{", "this", ".", "_loadAndCreateDraggable", "(", ")", ";", "}", "else", "{", "this", ".", "_destroyDraggable", "(", ")", ";", "}", "}", "}", "else", "if", "(", "propertyName", "===", "\"title\"", ")", "{", "this", ".", "_cfg", ".", "title", "=", "newValue", ";", "if", "(", "this", ".", "_titleDomElt", ")", "{", "this", ".", "_titleDomElt", ".", "innerHTML", "=", "newValue", ";", "this", ".", "_onDimensionsChanged", "(", ")", ";", "}", "}", "else", "if", "(", "propertyName", "===", "\"macro\"", ")", "{", "this", ".", "_cfg", ".", "macro", "=", "newValue", ";", "if", "(", "this", ".", "_popup", ")", "{", "if", "(", "!", "this", ".", "_popup", ".", "isOpen", ")", "{", "this", ".", "open", "(", ")", ";", "}", "else", "{", "var", "args", "=", "{", "section", ":", "\"__dialogContent_\"", "+", "this", ".", "_domId", ",", "macro", ":", "newValue", "}", ";", "this", ".", "_context", ".", "$refresh", "(", "args", ")", ";", "}", "}", "}", "else", "if", "(", "propertyName", "===", "\"xpos\"", "||", "propertyName", "===", "\"ypos\"", ")", "{", "this", ".", "_cfg", "[", "propertyName", "]", "=", "newValue", ";", "this", ".", "setProperty", "(", "\"center\"", ",", "false", ")", ";", "this", ".", "updatePosition", "(", ")", ";", "}", "else", "if", "(", "propertyName", "===", "\"center\"", ")", "{", "this", ".", "_cfg", ".", "center", "=", "newValue", ";", "this", ".", "updatePosition", "(", ")", ";", "}", "else", "if", "(", "propertyName", "===", "\"maximized\"", ")", "{", "this", ".", "_toggleMaximize", "(", "newValue", ")", ";", "}", "else", "if", "(", "propertyName", "===", "\"width\"", "||", "propertyName", "===", "\"height\"", ")", "{", "this", ".", "_onDimensionsChanged", "(", "false", ")", ";", "}", "else", "if", "(", "propertyName", "===", "\"restoreFocusOnClose\"", ")", "{", "this", ".", "_cfg", "[", "propertyName", "]", "=", "newValue", ";", "}", "else", "{", "this", ".", "$Container", ".", "_onBoundPropertyChange", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}", "}" ]
Internal method called when one of the model property that the widget is bound to has changed. Must be overridden by sub-classes defining bindable properties @param {String} propertyName the property name @param {Object} newValue the new value @param {Object} oldValue the old property value @protected @override
[ "Internal", "method", "called", "when", "one", "of", "the", "model", "property", "that", "the", "widget", "is", "bound", "to", "has", "changed", ".", "Must", "be", "overridden", "by", "sub", "-", "classes", "defining", "bindable", "properties" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L541-L595
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { var cfg = this._cfg; var waiEscapeMsg = cfg.waiEscapeMsg; var confirmed = !(cfg.waiAria && waiEscapeMsg); if (!confirmed) { var now = new Date().getTime(); confirmed = this._firstEscapeTime && (now - this._firstEscapeTime) <= 3000; if (!confirmed) { this._firstEscapeTime = now; this.waiReadText(waiEscapeMsg); } } if (confirmed) { this._firstEscapeTime = null; this.actionClose(); } }
javascript
function () { var cfg = this._cfg; var waiEscapeMsg = cfg.waiEscapeMsg; var confirmed = !(cfg.waiAria && waiEscapeMsg); if (!confirmed) { var now = new Date().getTime(); confirmed = this._firstEscapeTime && (now - this._firstEscapeTime) <= 3000; if (!confirmed) { this._firstEscapeTime = now; this.waiReadText(waiEscapeMsg); } } if (confirmed) { this._firstEscapeTime = null; this.actionClose(); } }
[ "function", "(", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "var", "waiEscapeMsg", "=", "cfg", ".", "waiEscapeMsg", ";", "var", "confirmed", "=", "!", "(", "cfg", ".", "waiAria", "&&", "waiEscapeMsg", ")", ";", "if", "(", "!", "confirmed", ")", "{", "var", "now", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "confirmed", "=", "this", ".", "_firstEscapeTime", "&&", "(", "now", "-", "this", ".", "_firstEscapeTime", ")", "<=", "3000", ";", "if", "(", "!", "confirmed", ")", "{", "this", ".", "_firstEscapeTime", "=", "now", ";", "this", ".", "waiReadText", "(", "waiEscapeMsg", ")", ";", "}", "}", "if", "(", "confirmed", ")", "{", "this", ".", "_firstEscapeTime", "=", "null", ";", "this", ".", "actionClose", "(", ")", ";", "}", "}" ]
This function is called when escape is pressed. If waiAria is true and waiEscapeMsg is defined, escape has to be pressed twice in less than 3s to close the popup.
[ "This", "function", "is", "called", "when", "escape", "is", "pressed", ".", "If", "waiAria", "is", "true", "and", "waiEscapeMsg", "is", "defined", "escape", "has", "to", "be", "pressed", "twice", "in", "less", "than", "3s", "to", "close", "the", "popup", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L661-L677
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { // --------------------------------------------------- destructuring var cfg = this._cfg; var modal = cfg.modal; var waiAria = cfg.waiAria; // ------------------------------------------------------ processing // refreshParams --------------------------------------------------- var refreshParams = { section : "__dialog_" + this._domId, writerCallback : { fn : this._writerCallback, scope : this } }; // popupContainer -------------------------------------------------- var popupContainer = PopupContainerManager.createPopupContainer(cfg.container); this._popupContainer = popupContainer; // previouslyFocusedElement ---------------------------------------- if (modal) { this._previouslyFocusedElement = Aria.$window.document.activeElement; } // optionsBeforeMaximize ------------------------------------------- // store current options to reapply them when unmaximized this._optionsBeforeMaximize = this._createOptionsBeforeMaximize(cfg); // section --------------------------------------------------------- var section = this._context.getRefreshedSection(refreshParams); // popup ----------------------------------------------------------- var popup = new ariaPopupsPopup(); this._popup = popup; popup.$on({ "onAfterOpen" : this._onAfterPopupOpen, "onEscape" : this._onEscape, "onAfterClose" : this._onAfterPopupClose, scope : this }); if (cfg.closeOnMouseClick) { popup.$on({ "onMouseClickClose" : this._onMouseClickClose, scope : this }); } popup.open({ section : section, keepSection : true, absolutePosition : { left : cfg.xpos, top : cfg.ypos }, center : cfg.center, maximized : cfg.maximized, offset : cfg.maximized ? this._shadows : this._shadowsZero, modal : modal, maskCssClass : "xDialogMask", popupContainer : popupContainer, closeOnMouseClick : cfg.closeOnMouseClick, closeOnMouseScroll : false, parentDialog : this, zIndexKeepOpenOrder : false, // allows to re-order dialogs (dynamic z-index) role: modal ? "dialog" : null, labelId: modal ? this.__getLabelId() : null, waiAria: waiAria }); // hiddenElements -------------------------------------------------- if (modal && waiAria) { var container = popupContainer.getContainerElt(); this._showBack = DomNavigationManager.hidingManager.hideOthers(popup.domElement, function (element) { return element != null && element !== container; }); } // ----------------------------------------------------------------- // must be registered before we check for _cfg.maximized, to fire the event correctly after overflow change ariaTemplatesLayout.$on({ "viewportResized" : this._onViewportResized, scope : this }); // ----------------------------------------------------------------- // in case when bound "maximized" was toggled while Dialog was not visible if (cfg.maximized) { this._setContainerOverflow("hidden"); this._setMaximizedHeightAndWidth(); } this._firstEscapeTime = null; }
javascript
function () { // --------------------------------------------------- destructuring var cfg = this._cfg; var modal = cfg.modal; var waiAria = cfg.waiAria; // ------------------------------------------------------ processing // refreshParams --------------------------------------------------- var refreshParams = { section : "__dialog_" + this._domId, writerCallback : { fn : this._writerCallback, scope : this } }; // popupContainer -------------------------------------------------- var popupContainer = PopupContainerManager.createPopupContainer(cfg.container); this._popupContainer = popupContainer; // previouslyFocusedElement ---------------------------------------- if (modal) { this._previouslyFocusedElement = Aria.$window.document.activeElement; } // optionsBeforeMaximize ------------------------------------------- // store current options to reapply them when unmaximized this._optionsBeforeMaximize = this._createOptionsBeforeMaximize(cfg); // section --------------------------------------------------------- var section = this._context.getRefreshedSection(refreshParams); // popup ----------------------------------------------------------- var popup = new ariaPopupsPopup(); this._popup = popup; popup.$on({ "onAfterOpen" : this._onAfterPopupOpen, "onEscape" : this._onEscape, "onAfterClose" : this._onAfterPopupClose, scope : this }); if (cfg.closeOnMouseClick) { popup.$on({ "onMouseClickClose" : this._onMouseClickClose, scope : this }); } popup.open({ section : section, keepSection : true, absolutePosition : { left : cfg.xpos, top : cfg.ypos }, center : cfg.center, maximized : cfg.maximized, offset : cfg.maximized ? this._shadows : this._shadowsZero, modal : modal, maskCssClass : "xDialogMask", popupContainer : popupContainer, closeOnMouseClick : cfg.closeOnMouseClick, closeOnMouseScroll : false, parentDialog : this, zIndexKeepOpenOrder : false, // allows to re-order dialogs (dynamic z-index) role: modal ? "dialog" : null, labelId: modal ? this.__getLabelId() : null, waiAria: waiAria }); // hiddenElements -------------------------------------------------- if (modal && waiAria) { var container = popupContainer.getContainerElt(); this._showBack = DomNavigationManager.hidingManager.hideOthers(popup.domElement, function (element) { return element != null && element !== container; }); } // ----------------------------------------------------------------- // must be registered before we check for _cfg.maximized, to fire the event correctly after overflow change ariaTemplatesLayout.$on({ "viewportResized" : this._onViewportResized, scope : this }); // ----------------------------------------------------------------- // in case when bound "maximized" was toggled while Dialog was not visible if (cfg.maximized) { this._setContainerOverflow("hidden"); this._setMaximizedHeightAndWidth(); } this._firstEscapeTime = null; }
[ "function", "(", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "var", "modal", "=", "cfg", ".", "modal", ";", "var", "waiAria", "=", "cfg", ".", "waiAria", ";", "var", "refreshParams", "=", "{", "section", ":", "\"__dialog_\"", "+", "this", ".", "_domId", ",", "writerCallback", ":", "{", "fn", ":", "this", ".", "_writerCallback", ",", "scope", ":", "this", "}", "}", ";", "var", "popupContainer", "=", "PopupContainerManager", ".", "createPopupContainer", "(", "cfg", ".", "container", ")", ";", "this", ".", "_popupContainer", "=", "popupContainer", ";", "if", "(", "modal", ")", "{", "this", ".", "_previouslyFocusedElement", "=", "Aria", ".", "$window", ".", "document", ".", "activeElement", ";", "}", "this", ".", "_optionsBeforeMaximize", "=", "this", ".", "_createOptionsBeforeMaximize", "(", "cfg", ")", ";", "var", "section", "=", "this", ".", "_context", ".", "getRefreshedSection", "(", "refreshParams", ")", ";", "var", "popup", "=", "new", "ariaPopupsPopup", "(", ")", ";", "this", ".", "_popup", "=", "popup", ";", "popup", ".", "$on", "(", "{", "\"onAfterOpen\"", ":", "this", ".", "_onAfterPopupOpen", ",", "\"onEscape\"", ":", "this", ".", "_onEscape", ",", "\"onAfterClose\"", ":", "this", ".", "_onAfterPopupClose", ",", "scope", ":", "this", "}", ")", ";", "if", "(", "cfg", ".", "closeOnMouseClick", ")", "{", "popup", ".", "$on", "(", "{", "\"onMouseClickClose\"", ":", "this", ".", "_onMouseClickClose", ",", "scope", ":", "this", "}", ")", ";", "}", "popup", ".", "open", "(", "{", "section", ":", "section", ",", "keepSection", ":", "true", ",", "absolutePosition", ":", "{", "left", ":", "cfg", ".", "xpos", ",", "top", ":", "cfg", ".", "ypos", "}", ",", "center", ":", "cfg", ".", "center", ",", "maximized", ":", "cfg", ".", "maximized", ",", "offset", ":", "cfg", ".", "maximized", "?", "this", ".", "_shadows", ":", "this", ".", "_shadowsZero", ",", "modal", ":", "modal", ",", "maskCssClass", ":", "\"xDialogMask\"", ",", "popupContainer", ":", "popupContainer", ",", "closeOnMouseClick", ":", "cfg", ".", "closeOnMouseClick", ",", "closeOnMouseScroll", ":", "false", ",", "parentDialog", ":", "this", ",", "zIndexKeepOpenOrder", ":", "false", ",", "role", ":", "modal", "?", "\"dialog\"", ":", "null", ",", "labelId", ":", "modal", "?", "this", ".", "__getLabelId", "(", ")", ":", "null", ",", "waiAria", ":", "waiAria", "}", ")", ";", "if", "(", "modal", "&&", "waiAria", ")", "{", "var", "container", "=", "popupContainer", ".", "getContainerElt", "(", ")", ";", "this", ".", "_showBack", "=", "DomNavigationManager", ".", "hidingManager", ".", "hideOthers", "(", "popup", ".", "domElement", ",", "function", "(", "element", ")", "{", "return", "element", "!=", "null", "&&", "element", "!==", "container", ";", "}", ")", ";", "}", "ariaTemplatesLayout", ".", "$on", "(", "{", "\"viewportResized\"", ":", "this", ".", "_onViewportResized", ",", "scope", ":", "this", "}", ")", ";", "if", "(", "cfg", ".", "maximized", ")", "{", "this", ".", "_setContainerOverflow", "(", "\"hidden\"", ")", ";", "this", ".", "_setMaximizedHeightAndWidth", "(", ")", ";", "}", "this", ".", "_firstEscapeTime", "=", "null", ";", "}" ]
Creates and displays the popup.
[ "Creates", "and", "displays", "the", "popup", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L718-L826
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { var cfg = this._cfg; var getDomElementChild = ariaUtilsDom.getDomElementChild; this._domElt = this._popup.domElement; var titleBarDomElt = this._titleBarDomElt = getDomElementChild(this._domElt, 0, titleLast); this._titleDomElt = getDomElementChild(titleBarDomElt, cfg.icon ? 1 : 0); this._onDimensionsChanged(); this._calculatePosition(); if (cfg.autoFocus) { ariaTemplatesNavigationManager.focusFirst(this._domElt); } else if (cfg.modal) { var document = Aria.$window.document; var activeElement = document.activeElement; if (activeElement && activeElement !== document.body) { activeElement.blur(); } } ariaCoreTimer.addCallback({ fn : function () { // check that the dialog was not disposed if (this._cfg) { this.waiReadText(cfg.waiOpenMsg); this.evalCallback(cfg.onOpen); } }, scope : this, delay : 4 }); if (cfg.maximized) { return; // don't create movable nor resizable } if (cfg.movable) { this._loadAndCreateDraggable(); } if (cfg.resizable) { this._loadAndCreateResizable(); } }
javascript
function () { var cfg = this._cfg; var getDomElementChild = ariaUtilsDom.getDomElementChild; this._domElt = this._popup.domElement; var titleBarDomElt = this._titleBarDomElt = getDomElementChild(this._domElt, 0, titleLast); this._titleDomElt = getDomElementChild(titleBarDomElt, cfg.icon ? 1 : 0); this._onDimensionsChanged(); this._calculatePosition(); if (cfg.autoFocus) { ariaTemplatesNavigationManager.focusFirst(this._domElt); } else if (cfg.modal) { var document = Aria.$window.document; var activeElement = document.activeElement; if (activeElement && activeElement !== document.body) { activeElement.blur(); } } ariaCoreTimer.addCallback({ fn : function () { // check that the dialog was not disposed if (this._cfg) { this.waiReadText(cfg.waiOpenMsg); this.evalCallback(cfg.onOpen); } }, scope : this, delay : 4 }); if (cfg.maximized) { return; // don't create movable nor resizable } if (cfg.movable) { this._loadAndCreateDraggable(); } if (cfg.resizable) { this._loadAndCreateResizable(); } }
[ "function", "(", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "var", "getDomElementChild", "=", "ariaUtilsDom", ".", "getDomElementChild", ";", "this", ".", "_domElt", "=", "this", ".", "_popup", ".", "domElement", ";", "var", "titleBarDomElt", "=", "this", ".", "_titleBarDomElt", "=", "getDomElementChild", "(", "this", ".", "_domElt", ",", "0", ",", "titleLast", ")", ";", "this", ".", "_titleDomElt", "=", "getDomElementChild", "(", "titleBarDomElt", ",", "cfg", ".", "icon", "?", "1", ":", "0", ")", ";", "this", ".", "_onDimensionsChanged", "(", ")", ";", "this", ".", "_calculatePosition", "(", ")", ";", "if", "(", "cfg", ".", "autoFocus", ")", "{", "ariaTemplatesNavigationManager", ".", "focusFirst", "(", "this", ".", "_domElt", ")", ";", "}", "else", "if", "(", "cfg", ".", "modal", ")", "{", "var", "document", "=", "Aria", ".", "$window", ".", "document", ";", "var", "activeElement", "=", "document", ".", "activeElement", ";", "if", "(", "activeElement", "&&", "activeElement", "!==", "document", ".", "body", ")", "{", "activeElement", ".", "blur", "(", ")", ";", "}", "}", "ariaCoreTimer", ".", "addCallback", "(", "{", "fn", ":", "function", "(", ")", "{", "if", "(", "this", ".", "_cfg", ")", "{", "this", ".", "waiReadText", "(", "cfg", ".", "waiOpenMsg", ")", ";", "this", ".", "evalCallback", "(", "cfg", ".", "onOpen", ")", ";", "}", "}", ",", "scope", ":", "this", ",", "delay", ":", "4", "}", ")", ";", "if", "(", "cfg", ".", "maximized", ")", "{", "return", ";", "}", "if", "(", "cfg", ".", "movable", ")", "{", "this", ".", "_loadAndCreateDraggable", "(", ")", ";", "}", "if", "(", "cfg", ".", "resizable", ")", "{", "this", ".", "_loadAndCreateResizable", "(", ")", ";", "}", "}" ]
Is called right after the popup is displayed.
[ "Is", "called", "right", "after", "the", "popup", "is", "displayed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L831-L874
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { if (aria.utils.dragdrop && aria.utils.dragdrop.Drag) { this._createDraggable(); } else { Aria.load({ classes : ["aria.utils.dragdrop.Drag"], oncomplete : { fn : this._createDraggable, scope : this } }); } }
javascript
function () { if (aria.utils.dragdrop && aria.utils.dragdrop.Drag) { this._createDraggable(); } else { Aria.load({ classes : ["aria.utils.dragdrop.Drag"], oncomplete : { fn : this._createDraggable, scope : this } }); } }
[ "function", "(", ")", "{", "if", "(", "aria", ".", "utils", ".", "dragdrop", "&&", "aria", ".", "utils", ".", "dragdrop", ".", "Drag", ")", "{", "this", ".", "_createDraggable", "(", ")", ";", "}", "else", "{", "Aria", ".", "load", "(", "{", "classes", ":", "[", "\"aria.utils.dragdrop.Drag\"", "]", ",", "oncomplete", ":", "{", "fn", ":", "this", ".", "_createDraggable", ",", "scope", ":", "this", "}", "}", ")", ";", "}", "}" ]
Create the Drag element; load the dependency before if not loaded yet.
[ "Create", "the", "Drag", "element", ";", "load", "the", "dependency", "before", "if", "not", "loaded", "yet", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L879-L891
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { if (aria.utils.resize && aria.utils.resize.Resize) { this._createResize(); } else { Aria.load({ classes : ["aria.utils.resize.Resize"], oncomplete : { fn : this._createResize, scope : this } }); } }
javascript
function () { if (aria.utils.resize && aria.utils.resize.Resize) { this._createResize(); } else { Aria.load({ classes : ["aria.utils.resize.Resize"], oncomplete : { fn : this._createResize, scope : this } }); } }
[ "function", "(", ")", "{", "if", "(", "aria", ".", "utils", ".", "resize", "&&", "aria", ".", "utils", ".", "resize", ".", "Resize", ")", "{", "this", ".", "_createResize", "(", ")", ";", "}", "else", "{", "Aria", ".", "load", "(", "{", "classes", ":", "[", "\"aria.utils.resize.Resize\"", "]", ",", "oncomplete", ":", "{", "fn", ":", "this", ".", "_createResize", ",", "scope", ":", "this", "}", "}", ")", ";", "}", "}" ]
Create the Resize element; load the dependency before if not loaded yet.
[ "Create", "the", "Resize", "element", ";", "load", "the", "dependency", "before", "if", "not", "loaded", "yet", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L896-L908
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { var cfg = this._cfg; var modal = cfg.modal; if (this._showBack != null) { this._showBack(); this._showBack = null; } if (this._popup) { this.waiReadText(cfg.waiCloseMsg); this._destroyDraggable(); this._destroyResizable(); if (cfg.maximized) { this._setContainerOverflow(this._optionsBeforeMaximize.containerOverflow); } this._domElt = null; this._titleBarDomElt = null; this._titleDomElt = null; if (this._closeDelegateId) { ariaUtilsDelegate.remove(this._closeDelegateId); } if (this._maximizeDelegateId) { ariaUtilsDelegate.remove(this._maximizeDelegateId); } this._popup.close(); this._popup.$unregisterListeners(this); this._popup.$dispose(); this._popup = null; PopupContainerManager.releasePopupContainer(this._popupContainer); this._popupContainer = null; ariaTemplatesLayout.$removeListeners({ "viewportResized" : this._onViewportResized, scope : this }); if (modal) { var previouslyFocusedElement = this._previouslyFocusedElement; if (cfg.restoreFocusOnClose && ariaUtilsDom.isInDom(previouslyFocusedElement) && !/^body$/i.test(previouslyFocusedElement.tagName)) { setTimeout(function () { try { // On IE 7 and 8, focusing an element which is no longer in the DOM // throws the "Unexpected call to method or property access." exception previouslyFocusedElement.focus(); } catch (e) {} }, 0); this._previouslyFocusedElement = null; } } } }
javascript
function () { var cfg = this._cfg; var modal = cfg.modal; if (this._showBack != null) { this._showBack(); this._showBack = null; } if (this._popup) { this.waiReadText(cfg.waiCloseMsg); this._destroyDraggable(); this._destroyResizable(); if (cfg.maximized) { this._setContainerOverflow(this._optionsBeforeMaximize.containerOverflow); } this._domElt = null; this._titleBarDomElt = null; this._titleDomElt = null; if (this._closeDelegateId) { ariaUtilsDelegate.remove(this._closeDelegateId); } if (this._maximizeDelegateId) { ariaUtilsDelegate.remove(this._maximizeDelegateId); } this._popup.close(); this._popup.$unregisterListeners(this); this._popup.$dispose(); this._popup = null; PopupContainerManager.releasePopupContainer(this._popupContainer); this._popupContainer = null; ariaTemplatesLayout.$removeListeners({ "viewportResized" : this._onViewportResized, scope : this }); if (modal) { var previouslyFocusedElement = this._previouslyFocusedElement; if (cfg.restoreFocusOnClose && ariaUtilsDom.isInDom(previouslyFocusedElement) && !/^body$/i.test(previouslyFocusedElement.tagName)) { setTimeout(function () { try { // On IE 7 and 8, focusing an element which is no longer in the DOM // throws the "Unexpected call to method or property access." exception previouslyFocusedElement.focus(); } catch (e) {} }, 0); this._previouslyFocusedElement = null; } } } }
[ "function", "(", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "var", "modal", "=", "cfg", ".", "modal", ";", "if", "(", "this", ".", "_showBack", "!=", "null", ")", "{", "this", ".", "_showBack", "(", ")", ";", "this", ".", "_showBack", "=", "null", ";", "}", "if", "(", "this", ".", "_popup", ")", "{", "this", ".", "waiReadText", "(", "cfg", ".", "waiCloseMsg", ")", ";", "this", ".", "_destroyDraggable", "(", ")", ";", "this", ".", "_destroyResizable", "(", ")", ";", "if", "(", "cfg", ".", "maximized", ")", "{", "this", ".", "_setContainerOverflow", "(", "this", ".", "_optionsBeforeMaximize", ".", "containerOverflow", ")", ";", "}", "this", ".", "_domElt", "=", "null", ";", "this", ".", "_titleBarDomElt", "=", "null", ";", "this", ".", "_titleDomElt", "=", "null", ";", "if", "(", "this", ".", "_closeDelegateId", ")", "{", "ariaUtilsDelegate", ".", "remove", "(", "this", ".", "_closeDelegateId", ")", ";", "}", "if", "(", "this", ".", "_maximizeDelegateId", ")", "{", "ariaUtilsDelegate", ".", "remove", "(", "this", ".", "_maximizeDelegateId", ")", ";", "}", "this", ".", "_popup", ".", "close", "(", ")", ";", "this", ".", "_popup", ".", "$unregisterListeners", "(", "this", ")", ";", "this", ".", "_popup", ".", "$dispose", "(", ")", ";", "this", ".", "_popup", "=", "null", ";", "PopupContainerManager", ".", "releasePopupContainer", "(", "this", ".", "_popupContainer", ")", ";", "this", ".", "_popupContainer", "=", "null", ";", "ariaTemplatesLayout", ".", "$removeListeners", "(", "{", "\"viewportResized\"", ":", "this", ".", "_onViewportResized", ",", "scope", ":", "this", "}", ")", ";", "if", "(", "modal", ")", "{", "var", "previouslyFocusedElement", "=", "this", ".", "_previouslyFocusedElement", ";", "if", "(", "cfg", ".", "restoreFocusOnClose", "&&", "ariaUtilsDom", ".", "isInDom", "(", "previouslyFocusedElement", ")", "&&", "!", "/", "^body$", "/", "i", ".", "test", "(", "previouslyFocusedElement", ".", "tagName", ")", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "try", "{", "previouslyFocusedElement", ".", "focus", "(", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "}", ",", "0", ")", ";", "this", ".", "_previouslyFocusedElement", "=", "null", ";", "}", "}", "}", "}" ]
Hides and destroys the dialog
[ "Hides", "and", "destroys", "the", "dialog" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L922-L977
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { if (this._popup && this._popup.isOpen) { this._popup.moveTo({ center : this._cfg.center, absolutePosition : { left : this._cfg.xpos, // in maximized mode, positioning is handled by the Popup itself top : this._cfg.ypos, height : this._cfg.maximized ? this._cfg.heightMaximized : this._cfg.height, width : this._cfg.maximized ? this._cfg.widthMaximized : this._cfg.width } }); this._calculatePosition(); } }
javascript
function () { if (this._popup && this._popup.isOpen) { this._popup.moveTo({ center : this._cfg.center, absolutePosition : { left : this._cfg.xpos, // in maximized mode, positioning is handled by the Popup itself top : this._cfg.ypos, height : this._cfg.maximized ? this._cfg.heightMaximized : this._cfg.height, width : this._cfg.maximized ? this._cfg.widthMaximized : this._cfg.width } }); this._calculatePosition(); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_popup", "&&", "this", ".", "_popup", ".", "isOpen", ")", "{", "this", ".", "_popup", ".", "moveTo", "(", "{", "center", ":", "this", ".", "_cfg", ".", "center", ",", "absolutePosition", ":", "{", "left", ":", "this", ".", "_cfg", ".", "xpos", ",", "top", ":", "this", ".", "_cfg", ".", "ypos", ",", "height", ":", "this", ".", "_cfg", ".", "maximized", "?", "this", ".", "_cfg", ".", "heightMaximized", ":", "this", ".", "_cfg", ".", "height", ",", "width", ":", "this", ".", "_cfg", ".", "maximized", "?", "this", ".", "_cfg", ".", "widthMaximized", ":", "this", ".", "_cfg", ".", "width", "}", "}", ")", ";", "this", ".", "_calculatePosition", "(", ")", ";", "}", "}" ]
Move the popup to the current position if it is visible
[ "Move", "the", "popup", "to", "the", "current", "position", "if", "it", "is", "visible" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1066-L1079
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { if (!this._cfg.maximized) { // in maximized mode, positioning is handled by the Popup itself var position = this._popupContainer.calculatePosition(this._domElt); this.setProperty("xpos", position.left); this.setProperty("ypos", position.top); } }
javascript
function () { if (!this._cfg.maximized) { // in maximized mode, positioning is handled by the Popup itself var position = this._popupContainer.calculatePosition(this._domElt); this.setProperty("xpos", position.left); this.setProperty("ypos", position.top); } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_cfg", ".", "maximized", ")", "{", "var", "position", "=", "this", ".", "_popupContainer", ".", "calculatePosition", "(", "this", ".", "_domElt", ")", ";", "this", ".", "setProperty", "(", "\"xpos\"", ",", "position", ".", "left", ")", ";", "this", ".", "setProperty", "(", "\"ypos\"", ",", "position", ".", "top", ")", ";", "}", "}" ]
Compute the actual position of the popup and update the data model with the correct values
[ "Compute", "the", "actual", "position", "of", "the", "popup", "and", "update", "the", "data", "model", "with", "the", "correct", "values" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1084-L1090
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { var opts = this._optionsBeforeMaximize; if (!opts) { return; } // reapply the old options if (this._popup) { this._popup.conf.maximized = false; this._popup.conf.offset = this._shadowsZero; this._setContainerOverflow(opts.containerOverflow); } // using setProperty instead of changeProperty for performance reasons; hence need to explicitly invoke // _onDimensionsChanged and updatePosition, instead of relying on onBoundPropertyChange this.setProperty("maxWidth", opts.maxWidth); this.setProperty("maxHeight", opts.maxHeight); this.setProperty("width", opts.width); this.setProperty("height", opts.height); this.setProperty("heightMaximized", null); this.setProperty("widthMaximized", null); this._onDimensionsChanged(false); if (opts.center) { this.setProperty("center", true); } else { this.setProperty("xpos", opts.xpos); this.setProperty("ypos", opts.ypos); } this.updatePosition(); if (this._popup && this._popup.isOpen) { if (this._cfg.resizable) { this._loadAndCreateResizable(); } if (this._cfg.movable) { this._loadAndCreateDraggable(); } } }
javascript
function () { var opts = this._optionsBeforeMaximize; if (!opts) { return; } // reapply the old options if (this._popup) { this._popup.conf.maximized = false; this._popup.conf.offset = this._shadowsZero; this._setContainerOverflow(opts.containerOverflow); } // using setProperty instead of changeProperty for performance reasons; hence need to explicitly invoke // _onDimensionsChanged and updatePosition, instead of relying on onBoundPropertyChange this.setProperty("maxWidth", opts.maxWidth); this.setProperty("maxHeight", opts.maxHeight); this.setProperty("width", opts.width); this.setProperty("height", opts.height); this.setProperty("heightMaximized", null); this.setProperty("widthMaximized", null); this._onDimensionsChanged(false); if (opts.center) { this.setProperty("center", true); } else { this.setProperty("xpos", opts.xpos); this.setProperty("ypos", opts.ypos); } this.updatePosition(); if (this._popup && this._popup.isOpen) { if (this._cfg.resizable) { this._loadAndCreateResizable(); } if (this._cfg.movable) { this._loadAndCreateDraggable(); } } }
[ "function", "(", ")", "{", "var", "opts", "=", "this", ".", "_optionsBeforeMaximize", ";", "if", "(", "!", "opts", ")", "{", "return", ";", "}", "if", "(", "this", ".", "_popup", ")", "{", "this", ".", "_popup", ".", "conf", ".", "maximized", "=", "false", ";", "this", ".", "_popup", ".", "conf", ".", "offset", "=", "this", ".", "_shadowsZero", ";", "this", ".", "_setContainerOverflow", "(", "opts", ".", "containerOverflow", ")", ";", "}", "this", ".", "setProperty", "(", "\"maxWidth\"", ",", "opts", ".", "maxWidth", ")", ";", "this", ".", "setProperty", "(", "\"maxHeight\"", ",", "opts", ".", "maxHeight", ")", ";", "this", ".", "setProperty", "(", "\"width\"", ",", "opts", ".", "width", ")", ";", "this", ".", "setProperty", "(", "\"height\"", ",", "opts", ".", "height", ")", ";", "this", ".", "setProperty", "(", "\"heightMaximized\"", ",", "null", ")", ";", "this", ".", "setProperty", "(", "\"widthMaximized\"", ",", "null", ")", ";", "this", ".", "_onDimensionsChanged", "(", "false", ")", ";", "if", "(", "opts", ".", "center", ")", "{", "this", ".", "setProperty", "(", "\"center\"", ",", "true", ")", ";", "}", "else", "{", "this", ".", "setProperty", "(", "\"xpos\"", ",", "opts", ".", "xpos", ")", ";", "this", ".", "setProperty", "(", "\"ypos\"", ",", "opts", ".", "ypos", ")", ";", "}", "this", ".", "updatePosition", "(", ")", ";", "if", "(", "this", ".", "_popup", "&&", "this", ".", "_popup", ".", "isOpen", ")", "{", "if", "(", "this", ".", "_cfg", ".", "resizable", ")", "{", "this", ".", "_loadAndCreateResizable", "(", ")", ";", "}", "if", "(", "this", ".", "_cfg", ".", "movable", ")", "{", "this", ".", "_loadAndCreateDraggable", "(", ")", ";", "}", "}", "}" ]
Unmaximize the Dialog. Reapply all the original options stored before maximizing.
[ "Unmaximize", "the", "Dialog", ".", "Reapply", "all", "the", "original", "options", "stored", "before", "maximizing", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1140-L1179
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function (cfg) { return { center : cfg.center, width : cfg.width, height : cfg.height, maxWidth : cfg.maxWidth, maxHeight : cfg.maxHeight, xpos : cfg.xpos, ypos : cfg.ypos, containerOverflow : this._popupContainer ? this._popupContainer.getContainerOverflow() : "" }; }
javascript
function (cfg) { return { center : cfg.center, width : cfg.width, height : cfg.height, maxWidth : cfg.maxWidth, maxHeight : cfg.maxHeight, xpos : cfg.xpos, ypos : cfg.ypos, containerOverflow : this._popupContainer ? this._popupContainer.getContainerOverflow() : "" }; }
[ "function", "(", "cfg", ")", "{", "return", "{", "center", ":", "cfg", ".", "center", ",", "width", ":", "cfg", ".", "width", ",", "height", ":", "cfg", ".", "height", ",", "maxWidth", ":", "cfg", ".", "maxWidth", ",", "maxHeight", ":", "cfg", ".", "maxHeight", ",", "xpos", ":", "cfg", ".", "xpos", ",", "ypos", ":", "cfg", ".", "ypos", ",", "containerOverflow", ":", "this", ".", "_popupContainer", "?", "this", ".", "_popupContainer", ".", "getContainerOverflow", "(", ")", ":", "\"\"", "}", ";", "}" ]
Returns the subset of config options which might be useful to restore the Dialog from maximized state. @param {aria.widgets.CfgBeans:DialogCfg} cfg the widget configuration @return {Object}
[ "Returns", "the", "subset", "of", "config", "options", "which", "might", "be", "useful", "to", "restore", "the", "Dialog", "from", "maximized", "state", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1186-L1197
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { if (!this._popup || !this._popup.isOpen || this._draggable) { // maybe the popup was closed while loading aria.utils.dragdrop.Drag, // or it was closed and re-opened very quickly (and we should avoid // creating the _draggable object twice) return; } this._draggable = new aria.utils.dragdrop.Drag(this._domElt, { handle : this._titleBarDomElt, cursor : "move", proxy : this._cfg.movableProxy, constrainTo : this._popupContainer.getContainerRef(), dragOverIFrame : true }); this._draggable.$on({ "dragstart" : { fn : this._onDragStart, scope : this }, "move" : { fn : this._onDragMove, scope : this }, "dragend" : { fn : this._onDragEnd, scope : this } }); }
javascript
function () { if (!this._popup || !this._popup.isOpen || this._draggable) { // maybe the popup was closed while loading aria.utils.dragdrop.Drag, // or it was closed and re-opened very quickly (and we should avoid // creating the _draggable object twice) return; } this._draggable = new aria.utils.dragdrop.Drag(this._domElt, { handle : this._titleBarDomElt, cursor : "move", proxy : this._cfg.movableProxy, constrainTo : this._popupContainer.getContainerRef(), dragOverIFrame : true }); this._draggable.$on({ "dragstart" : { fn : this._onDragStart, scope : this }, "move" : { fn : this._onDragMove, scope : this }, "dragend" : { fn : this._onDragEnd, scope : this } }); }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_popup", "||", "!", "this", ".", "_popup", ".", "isOpen", "||", "this", ".", "_draggable", ")", "{", "return", ";", "}", "this", ".", "_draggable", "=", "new", "aria", ".", "utils", ".", "dragdrop", ".", "Drag", "(", "this", ".", "_domElt", ",", "{", "handle", ":", "this", ".", "_titleBarDomElt", ",", "cursor", ":", "\"move\"", ",", "proxy", ":", "this", ".", "_cfg", ".", "movableProxy", ",", "constrainTo", ":", "this", ".", "_popupContainer", ".", "getContainerRef", "(", ")", ",", "dragOverIFrame", ":", "true", "}", ")", ";", "this", ".", "_draggable", ".", "$on", "(", "{", "\"dragstart\"", ":", "{", "fn", ":", "this", ".", "_onDragStart", ",", "scope", ":", "this", "}", ",", "\"move\"", ":", "{", "fn", ":", "this", ".", "_onDragMove", ",", "scope", ":", "this", "}", ",", "\"dragend\"", ":", "{", "fn", ":", "this", ".", "_onDragEnd", ",", "scope", ":", "this", "}", "}", ")", ";", "}" ]
Create the Drag element with the specified configuration @protected
[ "Create", "the", "Drag", "element", "with", "the", "specified", "configuration" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1231-L1259
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { if (!this._popup || !this._popup.isOpen || this._resizable) { // maybe the popup was closed while loading aria.utils.resize.Resize, // or it was closed and re-opened very quickly (and we should avoid // creating the _resizable object twice) return; } var handleArr = this._handlesArr; if (handleArr) { this._resizable = {}; for (var i = 0, ii = handleArr.length; i < ii; i++) { var handleElement = this.getResizeHandle(i), axis = null, cursor; cursor = handleArr[i]; if (cursor == "n-resize" || cursor == "s-resize") { axis = "y"; } if (cursor == "w-resize" || cursor == "e-resize") { axis = "x"; } this._resizable[cursor] = new aria.utils.resize.Resize(this._domElt, { handle : handleElement, cursor : cursor, axis : axis, constrainTo : this._popupContainer.getContainerRef() }); this._resizable[cursor].$on({ "beforeresize" : { fn : this._onResizeStart, scope : this }, "resize" : { fn : this._onResizing, scope : this }, "resizeend" : { fn : this._onResizeEnd, scope : this } }); } } }
javascript
function () { if (!this._popup || !this._popup.isOpen || this._resizable) { // maybe the popup was closed while loading aria.utils.resize.Resize, // or it was closed and re-opened very quickly (and we should avoid // creating the _resizable object twice) return; } var handleArr = this._handlesArr; if (handleArr) { this._resizable = {}; for (var i = 0, ii = handleArr.length; i < ii; i++) { var handleElement = this.getResizeHandle(i), axis = null, cursor; cursor = handleArr[i]; if (cursor == "n-resize" || cursor == "s-resize") { axis = "y"; } if (cursor == "w-resize" || cursor == "e-resize") { axis = "x"; } this._resizable[cursor] = new aria.utils.resize.Resize(this._domElt, { handle : handleElement, cursor : cursor, axis : axis, constrainTo : this._popupContainer.getContainerRef() }); this._resizable[cursor].$on({ "beforeresize" : { fn : this._onResizeStart, scope : this }, "resize" : { fn : this._onResizing, scope : this }, "resizeend" : { fn : this._onResizeEnd, scope : this } }); } } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_popup", "||", "!", "this", ".", "_popup", ".", "isOpen", "||", "this", ".", "_resizable", ")", "{", "return", ";", "}", "var", "handleArr", "=", "this", ".", "_handlesArr", ";", "if", "(", "handleArr", ")", "{", "this", ".", "_resizable", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ",", "ii", "=", "handleArr", ".", "length", ";", "i", "<", "ii", ";", "i", "++", ")", "{", "var", "handleElement", "=", "this", ".", "getResizeHandle", "(", "i", ")", ",", "axis", "=", "null", ",", "cursor", ";", "cursor", "=", "handleArr", "[", "i", "]", ";", "if", "(", "cursor", "==", "\"n-resize\"", "||", "cursor", "==", "\"s-resize\"", ")", "{", "axis", "=", "\"y\"", ";", "}", "if", "(", "cursor", "==", "\"w-resize\"", "||", "cursor", "==", "\"e-resize\"", ")", "{", "axis", "=", "\"x\"", ";", "}", "this", ".", "_resizable", "[", "cursor", "]", "=", "new", "aria", ".", "utils", ".", "resize", ".", "Resize", "(", "this", ".", "_domElt", ",", "{", "handle", ":", "handleElement", ",", "cursor", ":", "cursor", ",", "axis", ":", "axis", ",", "constrainTo", ":", "this", ".", "_popupContainer", ".", "getContainerRef", "(", ")", "}", ")", ";", "this", ".", "_resizable", "[", "cursor", "]", ".", "$on", "(", "{", "\"beforeresize\"", ":", "{", "fn", ":", "this", ".", "_onResizeStart", ",", "scope", ":", "this", "}", ",", "\"resize\"", ":", "{", "fn", ":", "this", ".", "_onResizing", ",", "scope", ":", "this", "}", ",", "\"resizeend\"", ":", "{", "fn", ":", "this", ".", "_onResizeEnd", ",", "scope", ":", "this", "}", "}", ")", ";", "}", "}", "}" ]
Creates the Resize element with all the resize handle element. @protected
[ "Creates", "the", "Resize", "element", "with", "all", "the", "resize", "handle", "element", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1272-L1313
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { // this.updatePosition(); if (this._popup) { this._popup.refreshProcessingIndicators(); } this.setProperty("center", false); this._calculatePosition(); this.updatePosition(); this.evalCallback(this._cfg.ondragend); }
javascript
function () { // this.updatePosition(); if (this._popup) { this._popup.refreshProcessingIndicators(); } this.setProperty("center", false); this._calculatePosition(); this.updatePosition(); this.evalCallback(this._cfg.ondragend); }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_popup", ")", "{", "this", ".", "_popup", ".", "refreshProcessingIndicators", "(", ")", ";", "}", "this", ".", "setProperty", "(", "\"center\"", ",", "false", ")", ";", "this", ".", "_calculatePosition", "(", ")", ";", "this", ".", "updatePosition", "(", ")", ";", "this", ".", "evalCallback", "(", "this", ".", "_cfg", ".", "ondragend", ")", ";", "}" ]
Internal handler for the "dragend" event raised by the Drag instance. Refresh the data model with the new position @protected
[ "Internal", "handler", "for", "the", "dragend", "event", "raised", "by", "the", "Drag", "instance", ".", "Refresh", "the", "data", "model", "with", "the", "new", "position" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1339-L1348
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { this._calculatePosition(); this._calculateSize(); this.setProperty("center", false); if (this._popup) { this._onDimensionsChanged(); this._popup.refreshProcessingIndicators(); } this.evalCallback(this._cfg.resizeend); }
javascript
function () { this._calculatePosition(); this._calculateSize(); this.setProperty("center", false); if (this._popup) { this._onDimensionsChanged(); this._popup.refreshProcessingIndicators(); } this.evalCallback(this._cfg.resizeend); }
[ "function", "(", ")", "{", "this", ".", "_calculatePosition", "(", ")", ";", "this", ".", "_calculateSize", "(", ")", ";", "this", ".", "setProperty", "(", "\"center\"", ",", "false", ")", ";", "if", "(", "this", ".", "_popup", ")", "{", "this", ".", "_onDimensionsChanged", "(", ")", ";", "this", ".", "_popup", ".", "refreshProcessingIndicators", "(", ")", ";", "}", "this", ".", "evalCallback", "(", "this", ".", "_cfg", ".", "resizeend", ")", ";", "}" ]
Internal handler for the "resizeend " event raised by the Drag instance on refresh handler. Refresh the data model with the new position and reopen the popup @protected
[ "Internal", "handler", "for", "the", "resizeend", "event", "raised", "by", "the", "Drag", "instance", "on", "refresh", "handler", ".", "Refresh", "the", "data", "model", "with", "the", "new", "position", "and", "reopen", "the", "popup" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1374-L1383
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { if (!this._draggable) { return; } this._draggable.$removeListeners({ "dragstart" : { fn : this._onDragStart, scope : this }, "move" : { fn : this._onDragMove, scope : this }, "dragend" : { fn : this._onDragEnd, scope : this } }); this._draggable.$dispose(); this._draggable = null; }
javascript
function () { if (!this._draggable) { return; } this._draggable.$removeListeners({ "dragstart" : { fn : this._onDragStart, scope : this }, "move" : { fn : this._onDragMove, scope : this }, "dragend" : { fn : this._onDragEnd, scope : this } }); this._draggable.$dispose(); this._draggable = null; }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_draggable", ")", "{", "return", ";", "}", "this", ".", "_draggable", ".", "$removeListeners", "(", "{", "\"dragstart\"", ":", "{", "fn", ":", "this", ".", "_onDragStart", ",", "scope", ":", "this", "}", ",", "\"move\"", ":", "{", "fn", ":", "this", ".", "_onDragMove", ",", "scope", ":", "this", "}", ",", "\"dragend\"", ":", "{", "fn", ":", "this", ".", "_onDragEnd", ",", "scope", ":", "this", "}", "}", ")", ";", "this", ".", "_draggable", ".", "$dispose", "(", ")", ";", "this", ".", "_draggable", "=", "null", ";", "}" ]
Remove listeners and dispose the Drag instance @protected
[ "Remove", "listeners", "and", "dispose", "the", "Drag", "instance" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1389-L1410
train
ariatemplates/ariatemplates
src/aria/widgets/container/Dialog.js
function () { var handleArr = this._handlesArr; if (!handleArr || !this._resizable) { return; } for (var i = 0, ii = handleArr.length; i < ii; i++) { var cursor = handleArr[i]; if (this._resizable[cursor]) { this._resizable[cursor].$dispose(); this._resizable[cursor] = null; } } this._resizable = null; }
javascript
function () { var handleArr = this._handlesArr; if (!handleArr || !this._resizable) { return; } for (var i = 0, ii = handleArr.length; i < ii; i++) { var cursor = handleArr[i]; if (this._resizable[cursor]) { this._resizable[cursor].$dispose(); this._resizable[cursor] = null; } } this._resizable = null; }
[ "function", "(", ")", "{", "var", "handleArr", "=", "this", ".", "_handlesArr", ";", "if", "(", "!", "handleArr", "||", "!", "this", ".", "_resizable", ")", "{", "return", ";", "}", "for", "(", "var", "i", "=", "0", ",", "ii", "=", "handleArr", ".", "length", ";", "i", "<", "ii", ";", "i", "++", ")", "{", "var", "cursor", "=", "handleArr", "[", "i", "]", ";", "if", "(", "this", ".", "_resizable", "[", "cursor", "]", ")", "{", "this", ".", "_resizable", "[", "cursor", "]", ".", "$dispose", "(", ")", ";", "this", ".", "_resizable", "[", "cursor", "]", "=", "null", ";", "}", "}", "this", ".", "_resizable", "=", "null", ";", "}" ]
Remove listeners and dispose the resize instance @protected
[ "Remove", "listeners", "and", "dispose", "the", "resize", "instance" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/container/Dialog.js#L1415-L1429
train
ariatemplates/ariatemplates
src/aria/pageEngine/utils/BaseNavigationManager.js
function () { var cache = this._cache; var expirationTime = ((new Date()).getTime() - this._expiresAfter * 1000); for (var url in cache) { if (cache.hasOwnProperty(url) && cache[url].age < expirationTime) { delete cache[url]; } } }
javascript
function () { var cache = this._cache; var expirationTime = ((new Date()).getTime() - this._expiresAfter * 1000); for (var url in cache) { if (cache.hasOwnProperty(url) && cache[url].age < expirationTime) { delete cache[url]; } } }
[ "function", "(", ")", "{", "var", "cache", "=", "this", ".", "_cache", ";", "var", "expirationTime", "=", "(", "(", "new", "Date", "(", ")", ")", ".", "getTime", "(", ")", "-", "this", ".", "_expiresAfter", "*", "1000", ")", ";", "for", "(", "var", "url", "in", "cache", ")", "{", "if", "(", "cache", ".", "hasOwnProperty", "(", "url", ")", "&&", "cache", "[", "url", "]", ".", "age", "<", "expirationTime", ")", "{", "delete", "cache", "[", "url", "]", ";", "}", "}", "}" ]
Remove old cache items. An item considered old if has been stored more than EXPIRATION_TIME seconds before @protected
[ "Remove", "old", "cache", "items", ".", "An", "item", "considered", "old", "if", "has", "been", "stored", "more", "than", "EXPIRATION_TIME", "seconds", "before" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/BaseNavigationManager.js#L157-L166
train
ariatemplates/ariatemplates
src/aria/html/TextInput.js
callNormalizedCallback
function callNormalizedCallback (callback, arg) { callback.fn.call(callback.scope, arg, callback.args); }
javascript
function callNormalizedCallback (callback, arg) { callback.fn.call(callback.scope, arg, callback.args); }
[ "function", "callNormalizedCallback", "(", "callback", ",", "arg", ")", "{", "callback", ".", "fn", ".", "call", "(", "callback", ".", "scope", ",", "arg", ",", "callback", ".", "args", ")", ";", "}" ]
Call a normalized callback with the correct arguments. @param {aria.core.CfgBeans:Callback} callback Function to be called @param {Object} arg first argument of the callback @private
[ "Call", "a", "normalized", "callback", "with", "the", "correct", "arguments", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/TextInput.js#L33-L35
train
ariatemplates/ariatemplates
src/aria/html/TextInput.js
typeCallback
function typeCallback (callbackArray) { this._typeCallback = null; var callback; for (var i = 0, count = callbackArray.length; i < count; i++) { callback = this.$normCallback.call(this._context._tpl, callbackArray[i]); callNormalizedCallback(callback, this._domElt.value); } }
javascript
function typeCallback (callbackArray) { this._typeCallback = null; var callback; for (var i = 0, count = callbackArray.length; i < count; i++) { callback = this.$normCallback.call(this._context._tpl, callbackArray[i]); callNormalizedCallback(callback, this._domElt.value); } }
[ "function", "typeCallback", "(", "callbackArray", ")", "{", "this", ".", "_typeCallback", "=", "null", ";", "var", "callback", ";", "for", "(", "var", "i", "=", "0", ",", "count", "=", "callbackArray", ".", "length", ";", "i", "<", "count", ";", "i", "++", ")", "{", "callback", "=", "this", ".", "$normCallback", ".", "call", "(", "this", ".", "_context", ".", "_tpl", ",", "callbackArray", "[", "i", "]", ")", ";", "callNormalizedCallback", "(", "callback", ",", "this", ".", "_domElt", ".", "value", ")", ";", "}", "}" ]
Callback for the type event timer. @private @param {Array} callbackArray Array whose entries are of type aria.core.CfgBeans:Callback. They are the handlers for the type event.
[ "Callback", "for", "the", "type", "event", "timer", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/TextInput.js#L43-L50
train
ariatemplates/ariatemplates
src/aria/html/TextInput.js
keyDownToType
function keyDownToType (event, callbackArray) { this._typeCallback = ariaCoreTimer.addCallback({ fn : typeCallback, scope : this, delay : 12, args : callbackArray }); }
javascript
function keyDownToType (event, callbackArray) { this._typeCallback = ariaCoreTimer.addCallback({ fn : typeCallback, scope : this, delay : 12, args : callbackArray }); }
[ "function", "keyDownToType", "(", "event", ",", "callbackArray", ")", "{", "this", ".", "_typeCallback", "=", "ariaCoreTimer", ".", "addCallback", "(", "{", "fn", ":", "typeCallback", ",", "scope", ":", "this", ",", "delay", ":", "12", ",", "args", ":", "callbackArray", "}", ")", ";", "}" ]
Convert a keydown event into a type event. This is achieved adding a very short callback on keydown. The reason being the fact that on keydown the input has still the previous value. In the callback we'll see the correct text input value. This function should have the same scope as the widget instance. @param {aria.DomEvent} event keydown event @param {Array} callbackArray Array of callbacks for the type event @private
[ "Convert", "a", "keydown", "event", "into", "a", "type", "event", ".", "This", "is", "achieved", "adding", "a", "very", "short", "callback", "on", "keydown", ".", "The", "reason", "being", "the", "fact", "that", "on", "keydown", "the", "input", "has", "still", "the", "previous", "value", ".", "In", "the", "callback", "we", "ll", "see", "the", "correct", "text", "input", "value", ".", "This", "function", "should", "have", "the", "same", "scope", "as", "the", "widget", "instance", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/TextInput.js#L60-L67
train
ariatemplates/ariatemplates
src/aria/html/TextInput.js
keyDownCallback
function keyDownCallback (event) { if (this._hasPlaceholder) { if (!ariaUtilsArray.contains(specialKeys, event.keyCode)) { this._removePlaceholder(); } else { event.preventDefault(); } } }
javascript
function keyDownCallback (event) { if (this._hasPlaceholder) { if (!ariaUtilsArray.contains(specialKeys, event.keyCode)) { this._removePlaceholder(); } else { event.preventDefault(); } } }
[ "function", "keyDownCallback", "(", "event", ")", "{", "if", "(", "this", ".", "_hasPlaceholder", ")", "{", "if", "(", "!", "ariaUtilsArray", ".", "contains", "(", "specialKeys", ",", "event", ".", "keyCode", ")", ")", "{", "this", ".", "_removePlaceholder", "(", ")", ";", "}", "else", "{", "event", ".", "preventDefault", "(", ")", ";", "}", "}", "}" ]
Internal callback for placeholder handling on keydown. @param {aria.DomEvent} event keydown event @private
[ "Internal", "callback", "for", "placeholder", "handling", "on", "keydown", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/TextInput.js#L81-L89
train
ariatemplates/ariatemplates
src/aria/html/TextInput.js
function (listeners, context) { if (listeners.type) { this._chainListener(listeners, "keydown", { fn : keyDownToType, scope : this, args : ariaUtilsType.isArray(listeners.type) ? listeners.type : [listeners.type] }); delete listeners.type; } }
javascript
function (listeners, context) { if (listeners.type) { this._chainListener(listeners, "keydown", { fn : keyDownToType, scope : this, args : ariaUtilsType.isArray(listeners.type) ? listeners.type : [listeners.type] }); delete listeners.type; } }
[ "function", "(", "listeners", ",", "context", ")", "{", "if", "(", "listeners", ".", "type", ")", "{", "this", ".", "_chainListener", "(", "listeners", ",", "\"keydown\"", ",", "{", "fn", ":", "keyDownToType", ",", "scope", ":", "this", ",", "args", ":", "ariaUtilsType", ".", "isArray", "(", "listeners", ".", "type", ")", "?", "listeners", ".", "type", ":", "[", "listeners", ".", "type", "]", "}", ")", ";", "delete", "listeners", ".", "type", ";", "}", "}" ]
Convert the special event type into a keydown event listener. @param {Object} listeners On listeners taken from the widget configuration. @param {aria.templates.TemplateCtxt} context Reference of the template context. @return {Boolean} Whether the keydown events should be converted back to type events. @protected
[ "Convert", "the", "special", "event", "type", "into", "a", "keydown", "event", "listener", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/TextInput.js#L292-L301
train
ariatemplates/ariatemplates
src/aria/html/TextInput.js
function () { if (this._hasPlaceholder) { var element = this._domElt; var cssClass = new aria.utils.ClassList(element); element.value = ""; this._hasPlaceholder = false; cssClass.remove('placeholder'); cssClass.$dispose(); this._domElt.unselectable = "off"; } }
javascript
function () { if (this._hasPlaceholder) { var element = this._domElt; var cssClass = new aria.utils.ClassList(element); element.value = ""; this._hasPlaceholder = false; cssClass.remove('placeholder'); cssClass.$dispose(); this._domElt.unselectable = "off"; } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_hasPlaceholder", ")", "{", "var", "element", "=", "this", ".", "_domElt", ";", "var", "cssClass", "=", "new", "aria", ".", "utils", ".", "ClassList", "(", "element", ")", ";", "element", ".", "value", "=", "\"\"", ";", "this", ".", "_hasPlaceholder", "=", "false", ";", "cssClass", ".", "remove", "(", "'placeholder'", ")", ";", "cssClass", ".", "$dispose", "(", ")", ";", "this", ".", "_domElt", ".", "unselectable", "=", "\"off\"", ";", "}", "}" ]
Remove the css class and value for placeholder if needed by browsers that don't support it natively. @protected
[ "Remove", "the", "css", "class", "and", "value", "for", "placeholder", "if", "needed", "by", "browsers", "that", "don", "t", "support", "it", "natively", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/html/TextInput.js#L340-L350
train
ariatemplates/ariatemplates
src/aria/utils/Caret.js
function (element) { var pos = { start : 0, end : 0 }; if ("selectionStart" in element) { // w3c standard, available in all but IE<9 pos.start = element.selectionStart; pos.end = element.selectionEnd; } else { // old IE support var document = Aria.$window.document; if (document.selection) { var sel = document.selection.createRange(); var initialLength = sel.text.length; sel.moveStart('character', -element.value.length); var x = sel.text.length; pos.start = x - initialLength; pos.end = x; } } return pos; }
javascript
function (element) { var pos = { start : 0, end : 0 }; if ("selectionStart" in element) { // w3c standard, available in all but IE<9 pos.start = element.selectionStart; pos.end = element.selectionEnd; } else { // old IE support var document = Aria.$window.document; if (document.selection) { var sel = document.selection.createRange(); var initialLength = sel.text.length; sel.moveStart('character', -element.value.length); var x = sel.text.length; pos.start = x - initialLength; pos.end = x; } } return pos; }
[ "function", "(", "element", ")", "{", "var", "pos", "=", "{", "start", ":", "0", ",", "end", ":", "0", "}", ";", "if", "(", "\"selectionStart\"", "in", "element", ")", "{", "pos", ".", "start", "=", "element", ".", "selectionStart", ";", "pos", ".", "end", "=", "element", ".", "selectionEnd", ";", "}", "else", "{", "var", "document", "=", "Aria", ".", "$window", ".", "document", ";", "if", "(", "document", ".", "selection", ")", "{", "var", "sel", "=", "document", ".", "selection", ".", "createRange", "(", ")", ";", "var", "initialLength", "=", "sel", ".", "text", ".", "length", ";", "sel", ".", "moveStart", "(", "'character'", ",", "-", "element", ".", "value", ".", "length", ")", ";", "var", "x", "=", "sel", ".", "text", ".", "length", ";", "pos", ".", "start", "=", "x", "-", "initialLength", ";", "pos", ".", "end", "=", "x", ";", "}", "}", "return", "pos", ";", "}" ]
Return the caret position of the HTML element @param {HTMLElement} element The html element @return {Object} The caret position (start and end)
[ "Return", "the", "caret", "position", "of", "the", "HTML", "element" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Caret.js#L31-L55
train