id
int32
0
58k
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
27,300
ariatemplates/ariatemplates
src/aria/core/transport/BaseXHR.js
function (reqId, connection) { connection.onreadystatechange = Aria.empty; ariaCoreIO.clearTimeout(reqId); if (this._inProgress(connection)) { connection.abort(); return true; } // else the request completed but after the abort timeout (it happens in IE) return false; }
javascript
function (reqId, connection) { connection.onreadystatechange = Aria.empty; ariaCoreIO.clearTimeout(reqId); if (this._inProgress(connection)) { connection.abort(); return true; } // else the request completed but after the abort timeout (it happens in IE) return false; }
[ "function", "(", "reqId", ",", "connection", ")", "{", "connection", ".", "onreadystatechange", "=", "Aria", ".", "empty", ";", "ariaCoreIO", ".", "clearTimeout", "(", "reqId", ")", ";", "if", "(", "this", ".", "_inProgress", "(", "connection", ")", ")", "{", "connection", ".", "abort", "(", ")", ";", "return", "true", ";", "}", "// else the request completed but after the abort timeout (it happens in IE)", "return", "false", ";", "}" ]
Abort method. Called after the request timeout @param {Number} reqId Request identifier @param {Object} connection @return {Boolean} Whether the connection was aborted or not
[ "Abort", "method", ".", "Called", "after", "the", "request", "timeout" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/transport/BaseXHR.js#L221-L231
27,301
ariatemplates/ariatemplates
src/aria/templates/Modifiers.js
function (modifierName, params) { // IMPORTANT: neither this method, nor any modifier, should assume // that `this === aria.templates.Modifiers` holds, // as they're copied in aria.core.Template (so 'this' is most of the time // an object extending aria.core.Template) modifierName = "" + modifierName; var modifier = __modifiers[modifierName.toLowerCase()]; if (modifier) { // call the modifier with this, so that this.$log is available return modifier.fn.apply(this, params); } else { this.$logError(aria.templates.Modifiers.UNKNOWN_MODIFIER, [modifierName]); } }
javascript
function (modifierName, params) { // IMPORTANT: neither this method, nor any modifier, should assume // that `this === aria.templates.Modifiers` holds, // as they're copied in aria.core.Template (so 'this' is most of the time // an object extending aria.core.Template) modifierName = "" + modifierName; var modifier = __modifiers[modifierName.toLowerCase()]; if (modifier) { // call the modifier with this, so that this.$log is available return modifier.fn.apply(this, params); } else { this.$logError(aria.templates.Modifiers.UNKNOWN_MODIFIER, [modifierName]); } }
[ "function", "(", "modifierName", ",", "params", ")", "{", "// IMPORTANT: neither this method, nor any modifier, should assume", "// that `this === aria.templates.Modifiers` holds,", "// as they're copied in aria.core.Template (so 'this' is most of the time", "// an object extending aria.core.Template)", "modifierName", "=", "\"\"", "+", "modifierName", ";", "var", "modifier", "=", "__modifiers", "[", "modifierName", ".", "toLowerCase", "(", ")", "]", ";", "if", "(", "modifier", ")", "{", "// call the modifier with this, so that this.$log is available", "return", "modifier", ".", "fn", ".", "apply", "(", "this", ",", "params", ")", ";", "}", "else", "{", "this", ".", "$logError", "(", "aria", ".", "templates", ".", "Modifiers", ".", "UNKNOWN_MODIFIER", ",", "[", "modifierName", "]", ")", ";", "}", "}" ]
Call the modifier function of a modifier object @param {String} modifierName @param {Array} params
[ "Call", "the", "modifier", "function", "of", "a", "modifier", "object" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Modifiers.js#L375-L388
27,302
ariatemplates/ariatemplates
src/aria/templates/Modifiers.js
function (modifierName, out) { var modifier = __modifiers[modifierName]; if (modifier && modifier.init) { modifier.init(out); } }
javascript
function (modifierName, out) { var modifier = __modifiers[modifierName]; if (modifier && modifier.init) { modifier.init(out); } }
[ "function", "(", "modifierName", ",", "out", ")", "{", "var", "modifier", "=", "__modifiers", "[", "modifierName", "]", ";", "if", "(", "modifier", "&&", "modifier", ".", "init", ")", "{", "modifier", ".", "init", "(", "out", ")", ";", "}", "}" ]
call the init function of a modifier object if it exists. This is done when the template is processed. @param {String} modifierName @param {aria.templates.ClassWriter} out
[ "call", "the", "init", "function", "of", "a", "modifier", "object", "if", "it", "exists", ".", "This", "is", "done", "when", "the", "template", "is", "processed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Modifiers.js#L395-L400
27,303
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (widgetName, skinClassName, skin, std) { // must return the normalizer for the frame state // get the frame type if (skin.frame == null) { skin.frame = {}; } var skinFrame = skin.frame; std = std || {}; var stdFrame = std.frame || {}; var frameType; var defaultFrameType = "Simple"; if (skin.simpleHTML) { frameType = "SimpleHTML"; } else { var possibleValues = [skinFrame.frameType, stdFrame.frameType, defaultFrameType /* default */]; for (var i = 0, l = possibleValues.length; i < l; i++) { if (possibleValues[i] != null) { frameType = possibleValues[i]; break; } } } var frameNormalizers = this._getFrameNormalizers(widgetName, skinClassName, frameType); if (frameNormalizers == null) { // wrong frame type, use the default instead frameType = defaultFrameType; frameNormalizers = this._getFrameNormalizers(widgetName, skinClassName, frameType); } skinFrame.frameType = frameType; frameNormalizers.normFrameSkinClass(skin, std); if (Aria.debug) { var res = this._check(skinFrame, 'aria.widgets.AriaSkinBeans.' + frameType + 'FrameCfg'); if (!res.result) { this.$logWarn(this.FRAME_NORMALIZATION_ERROR, [widgetName, skinClassName, res.message.replace(/\n/g, "\n ")]); } } return frameNormalizers.normFrameState; }
javascript
function (widgetName, skinClassName, skin, std) { // must return the normalizer for the frame state // get the frame type if (skin.frame == null) { skin.frame = {}; } var skinFrame = skin.frame; std = std || {}; var stdFrame = std.frame || {}; var frameType; var defaultFrameType = "Simple"; if (skin.simpleHTML) { frameType = "SimpleHTML"; } else { var possibleValues = [skinFrame.frameType, stdFrame.frameType, defaultFrameType /* default */]; for (var i = 0, l = possibleValues.length; i < l; i++) { if (possibleValues[i] != null) { frameType = possibleValues[i]; break; } } } var frameNormalizers = this._getFrameNormalizers(widgetName, skinClassName, frameType); if (frameNormalizers == null) { // wrong frame type, use the default instead frameType = defaultFrameType; frameNormalizers = this._getFrameNormalizers(widgetName, skinClassName, frameType); } skinFrame.frameType = frameType; frameNormalizers.normFrameSkinClass(skin, std); if (Aria.debug) { var res = this._check(skinFrame, 'aria.widgets.AriaSkinBeans.' + frameType + 'FrameCfg'); if (!res.result) { this.$logWarn(this.FRAME_NORMALIZATION_ERROR, [widgetName, skinClassName, res.message.replace(/\n/g, "\n ")]); } } return frameNormalizers.normFrameState; }
[ "function", "(", "widgetName", ",", "skinClassName", ",", "skin", ",", "std", ")", "{", "// must return the normalizer for the frame state", "// get the frame type", "if", "(", "skin", ".", "frame", "==", "null", ")", "{", "skin", ".", "frame", "=", "{", "}", ";", "}", "var", "skinFrame", "=", "skin", ".", "frame", ";", "std", "=", "std", "||", "{", "}", ";", "var", "stdFrame", "=", "std", ".", "frame", "||", "{", "}", ";", "var", "frameType", ";", "var", "defaultFrameType", "=", "\"Simple\"", ";", "if", "(", "skin", ".", "simpleHTML", ")", "{", "frameType", "=", "\"SimpleHTML\"", ";", "}", "else", "{", "var", "possibleValues", "=", "[", "skinFrame", ".", "frameType", ",", "stdFrame", ".", "frameType", ",", "defaultFrameType", "/* default */", "]", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "possibleValues", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "if", "(", "possibleValues", "[", "i", "]", "!=", "null", ")", "{", "frameType", "=", "possibleValues", "[", "i", "]", ";", "break", ";", "}", "}", "}", "var", "frameNormalizers", "=", "this", ".", "_getFrameNormalizers", "(", "widgetName", ",", "skinClassName", ",", "frameType", ")", ";", "if", "(", "frameNormalizers", "==", "null", ")", "{", "// wrong frame type, use the default instead", "frameType", "=", "defaultFrameType", ";", "frameNormalizers", "=", "this", ".", "_getFrameNormalizers", "(", "widgetName", ",", "skinClassName", ",", "frameType", ")", ";", "}", "skinFrame", ".", "frameType", "=", "frameType", ";", "frameNormalizers", ".", "normFrameSkinClass", "(", "skin", ",", "std", ")", ";", "if", "(", "Aria", ".", "debug", ")", "{", "var", "res", "=", "this", ".", "_check", "(", "skinFrame", ",", "'aria.widgets.AriaSkinBeans.'", "+", "frameType", "+", "'FrameCfg'", ")", ";", "if", "(", "!", "res", ".", "result", ")", "{", "this", ".", "$logWarn", "(", "this", ".", "FRAME_NORMALIZATION_ERROR", ",", "[", "widgetName", ",", "skinClassName", ",", "res", ".", "message", ".", "replace", "(", "/", "\\n", "/", "g", ",", "\"\\n \"", ")", "]", ")", ";", "}", "}", "return", "frameNormalizers", ".", "normFrameState", ";", "}" ]
Normalizes the frame properties for a skin class and returns the function which normalizes each frame state. This method is called for skin classes of widgets which use a frame. @param {String} widgetName name of the widget (in fact, the skinnable class, which may not correspond exactly to widgets) @param {String} skinClassName skin class name @param {Object} skin skin class to normalize @param {Object} std std skin class @return {Function}
[ "Normalizes", "the", "frame", "properties", "for", "a", "skin", "class", "and", "returns", "the", "function", "which", "normalizes", "each", "frame", "state", ".", "This", "method", "is", "called", "for", "skin", "classes", "of", "widgets", "which", "use", "a", "frame", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L117-L155
27,304
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (widgetName, skinClassName, stateName, stateFrame, beanName) { var res = this._check(stateFrame, beanName); if (!res.result) { this.$logWarn(this.FRAME_STATE_NORMALIZATION_ERROR, [widgetName, skinClassName, stateName, res.message.replace(/\n/g, "\n ")]); } }
javascript
function (widgetName, skinClassName, stateName, stateFrame, beanName) { var res = this._check(stateFrame, beanName); if (!res.result) { this.$logWarn(this.FRAME_STATE_NORMALIZATION_ERROR, [widgetName, skinClassName, stateName, res.message.replace(/\n/g, "\n ")]); } }
[ "function", "(", "widgetName", ",", "skinClassName", ",", "stateName", ",", "stateFrame", ",", "beanName", ")", "{", "var", "res", "=", "this", ".", "_check", "(", "stateFrame", ",", "beanName", ")", ";", "if", "(", "!", "res", ".", "result", ")", "{", "this", ".", "$logWarn", "(", "this", ".", "FRAME_STATE_NORMALIZATION_ERROR", ",", "[", "widgetName", ",", "skinClassName", ",", "stateName", ",", "res", ".", "message", ".", "replace", "(", "/", "\\n", "/", "g", ",", "\"\\n \"", ")", "]", ")", ";", "}", "}" ]
Checks a frame state according to its bean, and logs an error message in case there is an issue. @param {String} widgetName name of the widget (in fact, the skinnable class, which may not correspond exactly to widgets) @param {String} skinClassName @param {String} stateName @param {Object} stateFrame @param {Object} beanName
[ "Checks", "a", "frame", "state", "according", "to", "its", "bean", "and", "logs", "an", "error", "message", "in", "case", "there", "is", "an", "issue", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L166-L172
27,305
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (widgetName, skinClassName, frameType) { var res = this._frameNormalizers[frameType]; if (res == null) { var frameBeanDef = ariaCoreJsonValidator.getBean('aria.widgets.AriaSkinBeans.' + frameType + 'FrameCfg'); if (frameBeanDef == null) { this.$logError(this.INVALID_FRAME_TYPE, [widgetName, skinClassName, frameType]); return null; } res = { normFrameSkinClass : this._createFrameNormalizer(frameType, frameBeanDef), normFrameState : this._createFrameStateNormalizer(frameType, 'aria.widgets.AriaSkinBeans.' + frameType + 'FrameStateCfg') }; this._frameNormalizers[frameType] = res; } return res; }
javascript
function (widgetName, skinClassName, frameType) { var res = this._frameNormalizers[frameType]; if (res == null) { var frameBeanDef = ariaCoreJsonValidator.getBean('aria.widgets.AriaSkinBeans.' + frameType + 'FrameCfg'); if (frameBeanDef == null) { this.$logError(this.INVALID_FRAME_TYPE, [widgetName, skinClassName, frameType]); return null; } res = { normFrameSkinClass : this._createFrameNormalizer(frameType, frameBeanDef), normFrameState : this._createFrameStateNormalizer(frameType, 'aria.widgets.AriaSkinBeans.' + frameType + 'FrameStateCfg') }; this._frameNormalizers[frameType] = res; } return res; }
[ "function", "(", "widgetName", ",", "skinClassName", ",", "frameType", ")", "{", "var", "res", "=", "this", ".", "_frameNormalizers", "[", "frameType", "]", ";", "if", "(", "res", "==", "null", ")", "{", "var", "frameBeanDef", "=", "ariaCoreJsonValidator", ".", "getBean", "(", "'aria.widgets.AriaSkinBeans.'", "+", "frameType", "+", "'FrameCfg'", ")", ";", "if", "(", "frameBeanDef", "==", "null", ")", "{", "this", ".", "$logError", "(", "this", ".", "INVALID_FRAME_TYPE", ",", "[", "widgetName", ",", "skinClassName", ",", "frameType", "]", ")", ";", "return", "null", ";", "}", "res", "=", "{", "normFrameSkinClass", ":", "this", ".", "_createFrameNormalizer", "(", "frameType", ",", "frameBeanDef", ")", ",", "normFrameState", ":", "this", ".", "_createFrameStateNormalizer", "(", "frameType", ",", "'aria.widgets.AriaSkinBeans.'", "+", "frameType", "+", "'FrameStateCfg'", ")", "}", ";", "this", ".", "_frameNormalizers", "[", "frameType", "]", "=", "res", ";", "}", "return", "res", ";", "}" ]
Get the normalizer object for the given frame type. It is created if it does not exist already. @param {String} widgetName name of the widget (in fact, the skinnable class, which may not correspond exactly to widgets) @param {String} skinClassName skin class name @param {String} frameType frame type
[ "Get", "the", "normalizer", "object", "for", "the", "given", "frame", "type", ".", "It", "is", "created", "if", "it", "does", "not", "exist", "already", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L181-L198
27,306
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (skinObject) { if (skinObject['aria:skinNormalized']) { return; } for (var widget in skinObject) { if (skinObject.hasOwnProperty(widget) && widget != "general" && widget != "widgets") { skinObject[widget] = this.normalizeWidget(widget, skinObject[widget]); } } skinObject.general = this.normalizeGeneral(skinObject.general, "PageGeneralCfg"); if (skinObject.widgets) { skinObject.widgets = this.normalizeGeneral(skinObject.widgets, "WidgetGeneralCfg"); } skinObject['aria:skinNormalized'] = true; return skinObject; }
javascript
function (skinObject) { if (skinObject['aria:skinNormalized']) { return; } for (var widget in skinObject) { if (skinObject.hasOwnProperty(widget) && widget != "general" && widget != "widgets") { skinObject[widget] = this.normalizeWidget(widget, skinObject[widget]); } } skinObject.general = this.normalizeGeneral(skinObject.general, "PageGeneralCfg"); if (skinObject.widgets) { skinObject.widgets = this.normalizeGeneral(skinObject.widgets, "WidgetGeneralCfg"); } skinObject['aria:skinNormalized'] = true; return skinObject; }
[ "function", "(", "skinObject", ")", "{", "if", "(", "skinObject", "[", "'aria:skinNormalized'", "]", ")", "{", "return", ";", "}", "for", "(", "var", "widget", "in", "skinObject", ")", "{", "if", "(", "skinObject", ".", "hasOwnProperty", "(", "widget", ")", "&&", "widget", "!=", "\"general\"", "&&", "widget", "!=", "\"widgets\"", ")", "{", "skinObject", "[", "widget", "]", "=", "this", ".", "normalizeWidget", "(", "widget", ",", "skinObject", "[", "widget", "]", ")", ";", "}", "}", "skinObject", ".", "general", "=", "this", ".", "normalizeGeneral", "(", "skinObject", ".", "general", ",", "\"PageGeneralCfg\"", ")", ";", "if", "(", "skinObject", ".", "widgets", ")", "{", "skinObject", ".", "widgets", "=", "this", ".", "normalizeGeneral", "(", "skinObject", ".", "widgets", ",", "\"WidgetGeneralCfg\"", ")", ";", "}", "skinObject", "[", "'aria:skinNormalized'", "]", "=", "true", ";", "return", "skinObject", ";", "}" ]
Normalizes the skin, if not already done. @param {Object} Skin object
[ "Normalizes", "the", "skin", "if", "not", "already", "done", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L204-L219
27,307
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (widgetName, beanDef) { if (widgetName == "Icon") { // no inheritance, use usual normalization return function (skinClassName, skin, std) { beanDef.$fastNorm(skin); }; } var hasFrame = (beanDef.$properties.frame != null); var writer = new ariaUtilsFunctionWriter(["skinClassName", "skin", "std"]); ariaUtilsInheritanceNormalization.writeInheritanceNormalization({ writer : writer, beanDef : beanDef, varToNormalize : "skin", parentVars : ["std"], excludes : { "states" : true, "frame" : true } }); if (hasFrame) { // uses a frame, let's normalize it var frameStateNormalizerVar = writer.createTempVariable("this.normFrame(this.widgetName,skinClassName,skin,std)"); } var states = beanDef.$properties.states; if (states) { states = states.$properties; writer.writeEnsureObjectExists("skin.states"); var skinStatesVar = writer.createTempVariable("skin.states"); var stdStatesVar = writer.createTempVariable("std.states||{}"); var out = writer.out; for (var curState in states) { if (states.hasOwnProperty(curState) && curState != "normal") { var dotState = writer.getDotProperty(curState); writer.writeEnsureObjectExists(skinStatesVar + dotState); out.push("this.normState(", skinStatesVar, dotState, ",", stdStatesVar, dotState, ",", skinStatesVar, ".normal,", stdStatesVar, ".normal);"); if (hasFrame) { // uses a frame, let's normalize it out.push(frameStateNormalizerVar, ".call(this,skinClassName,", writer.stringify(curState), ",", skinStatesVar, dotState, ",", stdStatesVar, dotState, ",", skinStatesVar, ".normal, ", stdStatesVar, ".normal);"); } } } writer.writeEnsureObjectExists(skinStatesVar + ".normal"); out.push("this.normState(", skinStatesVar, ".normal, ", stdStatesVar, ".normal);"); if (hasFrame) { // uses a frame, let's normalize it out.push(frameStateNormalizerVar, '.call(this,skinClassName,"normal",', skinStatesVar, '.normal,', stdStatesVar, '.normal);'); } } var res = writer.createFunction(); writer.$dispose(); return res; }
javascript
function (widgetName, beanDef) { if (widgetName == "Icon") { // no inheritance, use usual normalization return function (skinClassName, skin, std) { beanDef.$fastNorm(skin); }; } var hasFrame = (beanDef.$properties.frame != null); var writer = new ariaUtilsFunctionWriter(["skinClassName", "skin", "std"]); ariaUtilsInheritanceNormalization.writeInheritanceNormalization({ writer : writer, beanDef : beanDef, varToNormalize : "skin", parentVars : ["std"], excludes : { "states" : true, "frame" : true } }); if (hasFrame) { // uses a frame, let's normalize it var frameStateNormalizerVar = writer.createTempVariable("this.normFrame(this.widgetName,skinClassName,skin,std)"); } var states = beanDef.$properties.states; if (states) { states = states.$properties; writer.writeEnsureObjectExists("skin.states"); var skinStatesVar = writer.createTempVariable("skin.states"); var stdStatesVar = writer.createTempVariable("std.states||{}"); var out = writer.out; for (var curState in states) { if (states.hasOwnProperty(curState) && curState != "normal") { var dotState = writer.getDotProperty(curState); writer.writeEnsureObjectExists(skinStatesVar + dotState); out.push("this.normState(", skinStatesVar, dotState, ",", stdStatesVar, dotState, ",", skinStatesVar, ".normal,", stdStatesVar, ".normal);"); if (hasFrame) { // uses a frame, let's normalize it out.push(frameStateNormalizerVar, ".call(this,skinClassName,", writer.stringify(curState), ",", skinStatesVar, dotState, ",", stdStatesVar, dotState, ",", skinStatesVar, ".normal, ", stdStatesVar, ".normal);"); } } } writer.writeEnsureObjectExists(skinStatesVar + ".normal"); out.push("this.normState(", skinStatesVar, ".normal, ", stdStatesVar, ".normal);"); if (hasFrame) { // uses a frame, let's normalize it out.push(frameStateNormalizerVar, '.call(this,skinClassName,"normal",', skinStatesVar, '.normal,', stdStatesVar, '.normal);'); } } var res = writer.createFunction(); writer.$dispose(); return res; }
[ "function", "(", "widgetName", ",", "beanDef", ")", "{", "if", "(", "widgetName", "==", "\"Icon\"", ")", "{", "// no inheritance, use usual normalization", "return", "function", "(", "skinClassName", ",", "skin", ",", "std", ")", "{", "beanDef", ".", "$fastNorm", "(", "skin", ")", ";", "}", ";", "}", "var", "hasFrame", "=", "(", "beanDef", ".", "$properties", ".", "frame", "!=", "null", ")", ";", "var", "writer", "=", "new", "ariaUtilsFunctionWriter", "(", "[", "\"skinClassName\"", ",", "\"skin\"", ",", "\"std\"", "]", ")", ";", "ariaUtilsInheritanceNormalization", ".", "writeInheritanceNormalization", "(", "{", "writer", ":", "writer", ",", "beanDef", ":", "beanDef", ",", "varToNormalize", ":", "\"skin\"", ",", "parentVars", ":", "[", "\"std\"", "]", ",", "excludes", ":", "{", "\"states\"", ":", "true", ",", "\"frame\"", ":", "true", "}", "}", ")", ";", "if", "(", "hasFrame", ")", "{", "// uses a frame, let's normalize it", "var", "frameStateNormalizerVar", "=", "writer", ".", "createTempVariable", "(", "\"this.normFrame(this.widgetName,skinClassName,skin,std)\"", ")", ";", "}", "var", "states", "=", "beanDef", ".", "$properties", ".", "states", ";", "if", "(", "states", ")", "{", "states", "=", "states", ".", "$properties", ";", "writer", ".", "writeEnsureObjectExists", "(", "\"skin.states\"", ")", ";", "var", "skinStatesVar", "=", "writer", ".", "createTempVariable", "(", "\"skin.states\"", ")", ";", "var", "stdStatesVar", "=", "writer", ".", "createTempVariable", "(", "\"std.states||{}\"", ")", ";", "var", "out", "=", "writer", ".", "out", ";", "for", "(", "var", "curState", "in", "states", ")", "{", "if", "(", "states", ".", "hasOwnProperty", "(", "curState", ")", "&&", "curState", "!=", "\"normal\"", ")", "{", "var", "dotState", "=", "writer", ".", "getDotProperty", "(", "curState", ")", ";", "writer", ".", "writeEnsureObjectExists", "(", "skinStatesVar", "+", "dotState", ")", ";", "out", ".", "push", "(", "\"this.normState(\"", ",", "skinStatesVar", ",", "dotState", ",", "\",\"", ",", "stdStatesVar", ",", "dotState", ",", "\",\"", ",", "skinStatesVar", ",", "\".normal,\"", ",", "stdStatesVar", ",", "\".normal);\"", ")", ";", "if", "(", "hasFrame", ")", "{", "// uses a frame, let's normalize it", "out", ".", "push", "(", "frameStateNormalizerVar", ",", "\".call(this,skinClassName,\"", ",", "writer", ".", "stringify", "(", "curState", ")", ",", "\",\"", ",", "skinStatesVar", ",", "dotState", ",", "\",\"", ",", "stdStatesVar", ",", "dotState", ",", "\",\"", ",", "skinStatesVar", ",", "\".normal, \"", ",", "stdStatesVar", ",", "\".normal);\"", ")", ";", "}", "}", "}", "writer", ".", "writeEnsureObjectExists", "(", "skinStatesVar", "+", "\".normal\"", ")", ";", "out", ".", "push", "(", "\"this.normState(\"", ",", "skinStatesVar", ",", "\".normal, \"", ",", "stdStatesVar", ",", "\".normal);\"", ")", ";", "if", "(", "hasFrame", ")", "{", "// uses a frame, let's normalize it", "out", ".", "push", "(", "frameStateNormalizerVar", ",", "'.call(this,skinClassName,\"normal\",'", ",", "skinStatesVar", ",", "'.normal,'", ",", "stdStatesVar", ",", "'.normal);'", ")", ";", "}", "}", "var", "res", "=", "writer", ".", "createFunction", "(", ")", ";", "writer", ".", "$dispose", "(", ")", ";", "return", "res", ";", "}" ]
Create a normalizer function for a widget. @param {String} widgetName name of the widget (in fact, the skinnable class, which may not correspond exactly to widgets) @param {Object} beanDef bean definition of the widget @return {Function}
[ "Create", "a", "normalizer", "function", "for", "a", "widget", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L228-L280
27,308
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (widgetName, beanDef) { var states = beanDef.$properties.states; if (states == null) { return null; } var writer = new ariaUtilsFunctionWriter(["state", "stdState", "normal", "stdNormal"]); ariaUtilsInheritanceNormalization.writeInheritanceNormalization({ writer : writer, beanDef : states.$properties.normal, varToNormalize : "state", parentVars : ["stdState", "normal", "stdNormal"], excludes : { "frame" : true } }); var res = writer.createFunction(); writer.$dispose(); return res; }
javascript
function (widgetName, beanDef) { var states = beanDef.$properties.states; if (states == null) { return null; } var writer = new ariaUtilsFunctionWriter(["state", "stdState", "normal", "stdNormal"]); ariaUtilsInheritanceNormalization.writeInheritanceNormalization({ writer : writer, beanDef : states.$properties.normal, varToNormalize : "state", parentVars : ["stdState", "normal", "stdNormal"], excludes : { "frame" : true } }); var res = writer.createFunction(); writer.$dispose(); return res; }
[ "function", "(", "widgetName", ",", "beanDef", ")", "{", "var", "states", "=", "beanDef", ".", "$properties", ".", "states", ";", "if", "(", "states", "==", "null", ")", "{", "return", "null", ";", "}", "var", "writer", "=", "new", "ariaUtilsFunctionWriter", "(", "[", "\"state\"", ",", "\"stdState\"", ",", "\"normal\"", ",", "\"stdNormal\"", "]", ")", ";", "ariaUtilsInheritanceNormalization", ".", "writeInheritanceNormalization", "(", "{", "writer", ":", "writer", ",", "beanDef", ":", "states", ".", "$properties", ".", "normal", ",", "varToNormalize", ":", "\"state\"", ",", "parentVars", ":", "[", "\"stdState\"", ",", "\"normal\"", ",", "\"stdNormal\"", "]", ",", "excludes", ":", "{", "\"frame\"", ":", "true", "}", "}", ")", ";", "var", "res", "=", "writer", ".", "createFunction", "(", ")", ";", "writer", ".", "$dispose", "(", ")", ";", "return", "res", ";", "}" ]
Create a state normalizer function for a widget. @param {String} widgetName @param {Object} beanDef @return {Function}
[ "Create", "a", "state", "normalizer", "function", "for", "a", "widget", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L288-L306
27,309
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (frameType, beanName) { var beanDef = ariaCoreJsonValidator.getBean(beanName); var writer = new ariaUtilsFunctionWriter(["skinClassName", "stateName", "state", "stdState", "normal", "stdNormal"]); writer.writeEnsureObjectExists("state.frame"); writer.writeEnsureObjectExists("stdState"); writer.writeEnsureObjectExists("normal"); writer.writeEnsureObjectExists("stdNormal"); ariaUtilsInheritanceNormalization.writeInheritanceNormalization({ writer : writer, beanDef : beanDef, varToNormalize : "state.frame", parentVars : ["state", "stdState.frame", "stdState", "normal.frame", "normal", "stdNormal.frame", "stdNormal"] }); // remove properties from the direct object in case they are present var properties = beanDef.$properties; for (var propName in properties) { if (properties.hasOwnProperty(propName)) { writer.out.push("delete state", writer.getDotProperty(propName), ";"); } } if (Aria.debug) { writer.out.push("this.checkFrameState(this.widgetName,skinClassName,stateName,state.frame,", writer.stringify(beanName), ");"); } var res = writer.createFunction(); writer.$dispose(); return res; }
javascript
function (frameType, beanName) { var beanDef = ariaCoreJsonValidator.getBean(beanName); var writer = new ariaUtilsFunctionWriter(["skinClassName", "stateName", "state", "stdState", "normal", "stdNormal"]); writer.writeEnsureObjectExists("state.frame"); writer.writeEnsureObjectExists("stdState"); writer.writeEnsureObjectExists("normal"); writer.writeEnsureObjectExists("stdNormal"); ariaUtilsInheritanceNormalization.writeInheritanceNormalization({ writer : writer, beanDef : beanDef, varToNormalize : "state.frame", parentVars : ["state", "stdState.frame", "stdState", "normal.frame", "normal", "stdNormal.frame", "stdNormal"] }); // remove properties from the direct object in case they are present var properties = beanDef.$properties; for (var propName in properties) { if (properties.hasOwnProperty(propName)) { writer.out.push("delete state", writer.getDotProperty(propName), ";"); } } if (Aria.debug) { writer.out.push("this.checkFrameState(this.widgetName,skinClassName,stateName,state.frame,", writer.stringify(beanName), ");"); } var res = writer.createFunction(); writer.$dispose(); return res; }
[ "function", "(", "frameType", ",", "beanName", ")", "{", "var", "beanDef", "=", "ariaCoreJsonValidator", ".", "getBean", "(", "beanName", ")", ";", "var", "writer", "=", "new", "ariaUtilsFunctionWriter", "(", "[", "\"skinClassName\"", ",", "\"stateName\"", ",", "\"state\"", ",", "\"stdState\"", ",", "\"normal\"", ",", "\"stdNormal\"", "]", ")", ";", "writer", ".", "writeEnsureObjectExists", "(", "\"state.frame\"", ")", ";", "writer", ".", "writeEnsureObjectExists", "(", "\"stdState\"", ")", ";", "writer", ".", "writeEnsureObjectExists", "(", "\"normal\"", ")", ";", "writer", ".", "writeEnsureObjectExists", "(", "\"stdNormal\"", ")", ";", "ariaUtilsInheritanceNormalization", ".", "writeInheritanceNormalization", "(", "{", "writer", ":", "writer", ",", "beanDef", ":", "beanDef", ",", "varToNormalize", ":", "\"state.frame\"", ",", "parentVars", ":", "[", "\"state\"", ",", "\"stdState.frame\"", ",", "\"stdState\"", ",", "\"normal.frame\"", ",", "\"normal\"", ",", "\"stdNormal.frame\"", ",", "\"stdNormal\"", "]", "}", ")", ";", "// remove properties from the direct object in case they are present", "var", "properties", "=", "beanDef", ".", "$properties", ";", "for", "(", "var", "propName", "in", "properties", ")", "{", "if", "(", "properties", ".", "hasOwnProperty", "(", "propName", ")", ")", "{", "writer", ".", "out", ".", "push", "(", "\"delete state\"", ",", "writer", ".", "getDotProperty", "(", "propName", ")", ",", "\";\"", ")", ";", "}", "}", "if", "(", "Aria", ".", "debug", ")", "{", "writer", ".", "out", ".", "push", "(", "\"this.checkFrameState(this.widgetName,skinClassName,stateName,state.frame,\"", ",", "writer", ".", "stringify", "(", "beanName", ")", ",", "\");\"", ")", ";", "}", "var", "res", "=", "writer", ".", "createFunction", "(", ")", ";", "writer", ".", "$dispose", "(", ")", ";", "return", "res", ";", "}" ]
Create the state normalizer function for a frame type. @param {String} frameType @param {String} beanName @return {Function}
[ "Create", "the", "state", "normalizer", "function", "for", "a", "frame", "type", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L314-L343
27,310
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (frameType, beanDef) { var writer = new ariaUtilsFunctionWriter(["skin", "std"]); var out = writer.out; // writer.writeEnsureObjectExists("skin.frame"); // not necessary, already done by normFrame // writer.writeEnsureObjectExists("std"); // not necessary, already done by normFrame ariaUtilsInheritanceNormalization.writeInheritanceNormalization({ writer : writer, beanDef : beanDef, varToNormalize : "skin.frame", parentVars : ["skin", "std.frame", "std"] }); // remove properties from the direct object in case they are present var properties = beanDef.$properties; for (var propName in properties) { if (properties.hasOwnProperty(propName)) { out.push("delete skin", writer.getDotProperty(propName), ";"); } } var res = writer.createFunction(); writer.$dispose(); return res; }
javascript
function (frameType, beanDef) { var writer = new ariaUtilsFunctionWriter(["skin", "std"]); var out = writer.out; // writer.writeEnsureObjectExists("skin.frame"); // not necessary, already done by normFrame // writer.writeEnsureObjectExists("std"); // not necessary, already done by normFrame ariaUtilsInheritanceNormalization.writeInheritanceNormalization({ writer : writer, beanDef : beanDef, varToNormalize : "skin.frame", parentVars : ["skin", "std.frame", "std"] }); // remove properties from the direct object in case they are present var properties = beanDef.$properties; for (var propName in properties) { if (properties.hasOwnProperty(propName)) { out.push("delete skin", writer.getDotProperty(propName), ";"); } } var res = writer.createFunction(); writer.$dispose(); return res; }
[ "function", "(", "frameType", ",", "beanDef", ")", "{", "var", "writer", "=", "new", "ariaUtilsFunctionWriter", "(", "[", "\"skin\"", ",", "\"std\"", "]", ")", ";", "var", "out", "=", "writer", ".", "out", ";", "// writer.writeEnsureObjectExists(\"skin.frame\"); // not necessary, already done by normFrame", "// writer.writeEnsureObjectExists(\"std\"); // not necessary, already done by normFrame", "ariaUtilsInheritanceNormalization", ".", "writeInheritanceNormalization", "(", "{", "writer", ":", "writer", ",", "beanDef", ":", "beanDef", ",", "varToNormalize", ":", "\"skin.frame\"", ",", "parentVars", ":", "[", "\"skin\"", ",", "\"std.frame\"", ",", "\"std\"", "]", "}", ")", ";", "// remove properties from the direct object in case they are present", "var", "properties", "=", "beanDef", ".", "$properties", ";", "for", "(", "var", "propName", "in", "properties", ")", "{", "if", "(", "properties", ".", "hasOwnProperty", "(", "propName", ")", ")", "{", "out", ".", "push", "(", "\"delete skin\"", ",", "writer", ".", "getDotProperty", "(", "propName", ")", ",", "\";\"", ")", ";", "}", "}", "var", "res", "=", "writer", ".", "createFunction", "(", ")", ";", "writer", ".", "$dispose", "(", ")", ";", "return", "res", ";", "}" ]
Create the normalizer function for a frame type. @param {String} frameType @param {Object} beanDef @return {Function}
[ "Create", "the", "normalizer", "function", "for", "a", "frame", "type", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L351-L372
27,311
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (widgetName, widgetSkinObj) { if (!this.skinnableClasses.hasOwnProperty(widgetName)) { this.$logError(this.INVALID_SKINNABLE_CLASS, [widgetName]); return null; } if (widgetSkinObj == null) { widgetSkinObj = {}; } var widgetNormalizer = this._getWidgetNormalizer(widgetName); var beanName = "aria.widgets.AriaSkinBeans." + widgetName + "Cfg"; var std = widgetSkinObj.std; if (std == null) { this.$logWarn(this.MISSING_STD_SKINCLASS, [widgetName]); std = {}; widgetSkinObj.std = std; } var result = true; var logs = ariaCoreLog; var msgs = []; var checkRes; // Note that the order of this process is very important (std must be normalized at the end only) for (var skinClassName in widgetSkinObj) { if (widgetSkinObj.hasOwnProperty(skinClassName) && skinClassName != "std") { var skinClass = widgetSkinObj[skinClassName]; widgetNormalizer.normSkinClass(skinClassName, skinClass, std); checkRes = this._check(skinClass, beanName); if (!checkRes.result) { result = false; } if (logs && checkRes.message) { msgs.push(logs.prepareLoggedMessage("In skin class %1:\n %2", [skinClassName, checkRes.message.replace(/\n/g, "\n ")])); } } } widgetNormalizer.normSkinClass("std", std, {}); checkRes = this._check(std, beanName); if (!checkRes.result) { result = false; } if (logs && checkRes.message) { msgs.push(logs.prepareLoggedMessage("In skin class %1:\n %2", ["std", checkRes.message.replace(/\n/g, "\n ")])); } if (!result) { this.$logWarn(this.WIDGET_NORMALIZATION_ERROR, [widgetName, msgs.join('\n').replace(/\n/g, "\n ")]); } widgetSkinObj['aria:skinNormalized'] = true; return widgetSkinObj; }
javascript
function (widgetName, widgetSkinObj) { if (!this.skinnableClasses.hasOwnProperty(widgetName)) { this.$logError(this.INVALID_SKINNABLE_CLASS, [widgetName]); return null; } if (widgetSkinObj == null) { widgetSkinObj = {}; } var widgetNormalizer = this._getWidgetNormalizer(widgetName); var beanName = "aria.widgets.AriaSkinBeans." + widgetName + "Cfg"; var std = widgetSkinObj.std; if (std == null) { this.$logWarn(this.MISSING_STD_SKINCLASS, [widgetName]); std = {}; widgetSkinObj.std = std; } var result = true; var logs = ariaCoreLog; var msgs = []; var checkRes; // Note that the order of this process is very important (std must be normalized at the end only) for (var skinClassName in widgetSkinObj) { if (widgetSkinObj.hasOwnProperty(skinClassName) && skinClassName != "std") { var skinClass = widgetSkinObj[skinClassName]; widgetNormalizer.normSkinClass(skinClassName, skinClass, std); checkRes = this._check(skinClass, beanName); if (!checkRes.result) { result = false; } if (logs && checkRes.message) { msgs.push(logs.prepareLoggedMessage("In skin class %1:\n %2", [skinClassName, checkRes.message.replace(/\n/g, "\n ")])); } } } widgetNormalizer.normSkinClass("std", std, {}); checkRes = this._check(std, beanName); if (!checkRes.result) { result = false; } if (logs && checkRes.message) { msgs.push(logs.prepareLoggedMessage("In skin class %1:\n %2", ["std", checkRes.message.replace(/\n/g, "\n ")])); } if (!result) { this.$logWarn(this.WIDGET_NORMALIZATION_ERROR, [widgetName, msgs.join('\n').replace(/\n/g, "\n ")]); } widgetSkinObj['aria:skinNormalized'] = true; return widgetSkinObj; }
[ "function", "(", "widgetName", ",", "widgetSkinObj", ")", "{", "if", "(", "!", "this", ".", "skinnableClasses", ".", "hasOwnProperty", "(", "widgetName", ")", ")", "{", "this", ".", "$logError", "(", "this", ".", "INVALID_SKINNABLE_CLASS", ",", "[", "widgetName", "]", ")", ";", "return", "null", ";", "}", "if", "(", "widgetSkinObj", "==", "null", ")", "{", "widgetSkinObj", "=", "{", "}", ";", "}", "var", "widgetNormalizer", "=", "this", ".", "_getWidgetNormalizer", "(", "widgetName", ")", ";", "var", "beanName", "=", "\"aria.widgets.AriaSkinBeans.\"", "+", "widgetName", "+", "\"Cfg\"", ";", "var", "std", "=", "widgetSkinObj", ".", "std", ";", "if", "(", "std", "==", "null", ")", "{", "this", ".", "$logWarn", "(", "this", ".", "MISSING_STD_SKINCLASS", ",", "[", "widgetName", "]", ")", ";", "std", "=", "{", "}", ";", "widgetSkinObj", ".", "std", "=", "std", ";", "}", "var", "result", "=", "true", ";", "var", "logs", "=", "ariaCoreLog", ";", "var", "msgs", "=", "[", "]", ";", "var", "checkRes", ";", "// Note that the order of this process is very important (std must be normalized at the end only)", "for", "(", "var", "skinClassName", "in", "widgetSkinObj", ")", "{", "if", "(", "widgetSkinObj", ".", "hasOwnProperty", "(", "skinClassName", ")", "&&", "skinClassName", "!=", "\"std\"", ")", "{", "var", "skinClass", "=", "widgetSkinObj", "[", "skinClassName", "]", ";", "widgetNormalizer", ".", "normSkinClass", "(", "skinClassName", ",", "skinClass", ",", "std", ")", ";", "checkRes", "=", "this", ".", "_check", "(", "skinClass", ",", "beanName", ")", ";", "if", "(", "!", "checkRes", ".", "result", ")", "{", "result", "=", "false", ";", "}", "if", "(", "logs", "&&", "checkRes", ".", "message", ")", "{", "msgs", ".", "push", "(", "logs", ".", "prepareLoggedMessage", "(", "\"In skin class %1:\\n %2\"", ",", "[", "skinClassName", ",", "checkRes", ".", "message", ".", "replace", "(", "/", "\\n", "/", "g", ",", "\"\\n \"", ")", "]", ")", ")", ";", "}", "}", "}", "widgetNormalizer", ".", "normSkinClass", "(", "\"std\"", ",", "std", ",", "{", "}", ")", ";", "checkRes", "=", "this", ".", "_check", "(", "std", ",", "beanName", ")", ";", "if", "(", "!", "checkRes", ".", "result", ")", "{", "result", "=", "false", ";", "}", "if", "(", "logs", "&&", "checkRes", ".", "message", ")", "{", "msgs", ".", "push", "(", "logs", ".", "prepareLoggedMessage", "(", "\"In skin class %1:\\n %2\"", ",", "[", "\"std\"", ",", "checkRes", ".", "message", ".", "replace", "(", "/", "\\n", "/", "g", ",", "\"\\n \"", ")", "]", ")", ")", ";", "}", "if", "(", "!", "result", ")", "{", "this", ".", "$logWarn", "(", "this", ".", "WIDGET_NORMALIZATION_ERROR", ",", "[", "widgetName", ",", "msgs", ".", "join", "(", "'\\n'", ")", ".", "replace", "(", "/", "\\n", "/", "g", ",", "\"\\n \"", ")", "]", ")", ";", "}", "widgetSkinObj", "[", "'aria:skinNormalized'", "]", "=", "true", ";", "return", "widgetSkinObj", ";", "}" ]
Returns the normalized widget skin configuration. @param {String} widgetName name of the widget (in fact, the skinnable class, which may not correspond exactly to widgets) @param {Object} widgetSkinObj object whose properties are all the skin classes for the widget. If it is not null, and widgetName is correct, this method returns this object, after normalization. @return {Object}
[ "Returns", "the", "normalized", "widget", "skin", "configuration", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L402-L451
27,312
ariatemplates/ariatemplates
src/aria/widgets/AriaSkinNormalization.js
function (general, beanType) { if (!general) { general = {}; } var param = { json : general, beanName : "aria.widgets.AriaSkinBeans." + beanType }; var normalizationResults = this._normalize(param); if (!normalizationResults.result) { this.$logWarn(this.GENERAL_NORMALIZATION_ERROR, [normalizationResults.message.replace(/\n/g, "\n ")]); } general['aria:skinNormalized'] = true; return param.json; }
javascript
function (general, beanType) { if (!general) { general = {}; } var param = { json : general, beanName : "aria.widgets.AriaSkinBeans." + beanType }; var normalizationResults = this._normalize(param); if (!normalizationResults.result) { this.$logWarn(this.GENERAL_NORMALIZATION_ERROR, [normalizationResults.message.replace(/\n/g, "\n ")]); } general['aria:skinNormalized'] = true; return param.json; }
[ "function", "(", "general", ",", "beanType", ")", "{", "if", "(", "!", "general", ")", "{", "general", "=", "{", "}", ";", "}", "var", "param", "=", "{", "json", ":", "general", ",", "beanName", ":", "\"aria.widgets.AriaSkinBeans.\"", "+", "beanType", "}", ";", "var", "normalizationResults", "=", "this", ".", "_normalize", "(", "param", ")", ";", "if", "(", "!", "normalizationResults", ".", "result", ")", "{", "this", ".", "$logWarn", "(", "this", ".", "GENERAL_NORMALIZATION_ERROR", ",", "[", "normalizationResults", ".", "message", ".", "replace", "(", "/", "\\n", "/", "g", ",", "\"\\n \"", ")", "]", ")", ";", "}", "general", "[", "'aria:skinNormalized'", "]", "=", "true", ";", "return", "param", ".", "json", ";", "}" ]
Normalizes the given general skin properties and returns it. @param {aria.widgets.AriaSkinBeans.WidgetsGeneralCfg|PageGeneralCfg} general @param {String} beanType
[ "Normalizes", "the", "given", "general", "skin", "properties", "and", "returns", "it", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/AriaSkinNormalization.js#L522-L536
27,313
ariatemplates/ariatemplates
src/aria/widgets/action/Button.js
function (out) { var cfg = this._cfg; var tabIndexString = (cfg.tabIndex != null ? ' tabindex="' + this._calculateTabIndex() + '" ' : ''); var titleString = cfg.tooltip ? ' title="' + ariaUtilsString.escapeHTMLAttr(cfg.tooltip) + '" ' : ''; var isIE7 = ariaCoreBrowser.isIE7; var ariaTestMode = (Aria.testMode) ? ' id="' + this._domId + '_button" ' : ''; var buttonClass = cfg.disabled ? "xButton xButtonDisabled" : "xButton"; var waiAriaAttributes = this._getWaiAriaMarkup(); var disableMarkup = ""; if (cfg.disabled) { if (!cfg.focusableWhenDisabled) { disableMarkup = " disabled "; } else if (cfg.waiAria) { disableMarkup = " aria-disabled='true' "; } } if (this._simpleHTML) { var styleMarkup = cfg.width != "-1" ? " style='width:" + cfg.width + "px;' " : ""; out.write([ '<', !cfg.waiAria ? 'input type="button" value="' + ariaUtilsString.encodeForQuotedHTMLAttribute(cfg.label) + '"' : 'button', waiAriaAttributes, ariaTestMode, tabIndexString, titleString, disableMarkup, styleMarkup, !cfg.waiAria ? '/>' : '>' + ariaUtilsString.escapeForHTML(cfg.label, {text: true}) + '</button>' ].join('')); } else { if (isIE7) { // FIXME: find a way to put a button also on IE7 // on IE7 the button is having display issues the current frame implementation inside it out.write(['<span class="' + buttonClass + '" style="margin: 0;"', waiAriaAttributes, tabIndexString, titleString, ariaTestMode, '>'].join('')); } else { out.write([ '<button', ' type="button"', ' class="' + buttonClass + '"', waiAriaAttributes, tabIndexString, titleString, ariaTestMode, disableMarkup, '>' ].join('')); } this._frame.writeMarkupBegin(out); // call the method to write the content of the button - here is is just // the label cfg attribute, but the method can be overwritten in child classes this._widgetMarkupContent(out); this._frame.writeMarkupEnd(out); if (isIE7) { out.write('</span>'); } else { out.write('</button>'); } } }
javascript
function (out) { var cfg = this._cfg; var tabIndexString = (cfg.tabIndex != null ? ' tabindex="' + this._calculateTabIndex() + '" ' : ''); var titleString = cfg.tooltip ? ' title="' + ariaUtilsString.escapeHTMLAttr(cfg.tooltip) + '" ' : ''; var isIE7 = ariaCoreBrowser.isIE7; var ariaTestMode = (Aria.testMode) ? ' id="' + this._domId + '_button" ' : ''; var buttonClass = cfg.disabled ? "xButton xButtonDisabled" : "xButton"; var waiAriaAttributes = this._getWaiAriaMarkup(); var disableMarkup = ""; if (cfg.disabled) { if (!cfg.focusableWhenDisabled) { disableMarkup = " disabled "; } else if (cfg.waiAria) { disableMarkup = " aria-disabled='true' "; } } if (this._simpleHTML) { var styleMarkup = cfg.width != "-1" ? " style='width:" + cfg.width + "px;' " : ""; out.write([ '<', !cfg.waiAria ? 'input type="button" value="' + ariaUtilsString.encodeForQuotedHTMLAttribute(cfg.label) + '"' : 'button', waiAriaAttributes, ariaTestMode, tabIndexString, titleString, disableMarkup, styleMarkup, !cfg.waiAria ? '/>' : '>' + ariaUtilsString.escapeForHTML(cfg.label, {text: true}) + '</button>' ].join('')); } else { if (isIE7) { // FIXME: find a way to put a button also on IE7 // on IE7 the button is having display issues the current frame implementation inside it out.write(['<span class="' + buttonClass + '" style="margin: 0;"', waiAriaAttributes, tabIndexString, titleString, ariaTestMode, '>'].join('')); } else { out.write([ '<button', ' type="button"', ' class="' + buttonClass + '"', waiAriaAttributes, tabIndexString, titleString, ariaTestMode, disableMarkup, '>' ].join('')); } this._frame.writeMarkupBegin(out); // call the method to write the content of the button - here is is just // the label cfg attribute, but the method can be overwritten in child classes this._widgetMarkupContent(out); this._frame.writeMarkupEnd(out); if (isIE7) { out.write('</span>'); } else { out.write('</button>'); } } }
[ "function", "(", "out", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "var", "tabIndexString", "=", "(", "cfg", ".", "tabIndex", "!=", "null", "?", "' tabindex=\"'", "+", "this", ".", "_calculateTabIndex", "(", ")", "+", "'\" '", ":", "''", ")", ";", "var", "titleString", "=", "cfg", ".", "tooltip", "?", "' title=\"'", "+", "ariaUtilsString", ".", "escapeHTMLAttr", "(", "cfg", ".", "tooltip", ")", "+", "'\" '", ":", "''", ";", "var", "isIE7", "=", "ariaCoreBrowser", ".", "isIE7", ";", "var", "ariaTestMode", "=", "(", "Aria", ".", "testMode", ")", "?", "' id=\"'", "+", "this", ".", "_domId", "+", "'_button\" '", ":", "''", ";", "var", "buttonClass", "=", "cfg", ".", "disabled", "?", "\"xButton xButtonDisabled\"", ":", "\"xButton\"", ";", "var", "waiAriaAttributes", "=", "this", ".", "_getWaiAriaMarkup", "(", ")", ";", "var", "disableMarkup", "=", "\"\"", ";", "if", "(", "cfg", ".", "disabled", ")", "{", "if", "(", "!", "cfg", ".", "focusableWhenDisabled", ")", "{", "disableMarkup", "=", "\" disabled \"", ";", "}", "else", "if", "(", "cfg", ".", "waiAria", ")", "{", "disableMarkup", "=", "\" aria-disabled='true' \"", ";", "}", "}", "if", "(", "this", ".", "_simpleHTML", ")", "{", "var", "styleMarkup", "=", "cfg", ".", "width", "!=", "\"-1\"", "?", "\" style='width:\"", "+", "cfg", ".", "width", "+", "\"px;' \"", ":", "\"\"", ";", "out", ".", "write", "(", "[", "'<'", ",", "!", "cfg", ".", "waiAria", "?", "'input type=\"button\" value=\"'", "+", "ariaUtilsString", ".", "encodeForQuotedHTMLAttribute", "(", "cfg", ".", "label", ")", "+", "'\"'", ":", "'button'", ",", "waiAriaAttributes", ",", "ariaTestMode", ",", "tabIndexString", ",", "titleString", ",", "disableMarkup", ",", "styleMarkup", ",", "!", "cfg", ".", "waiAria", "?", "'/>'", ":", "'>'", "+", "ariaUtilsString", ".", "escapeForHTML", "(", "cfg", ".", "label", ",", "{", "text", ":", "true", "}", ")", "+", "'</button>'", "]", ".", "join", "(", "''", ")", ")", ";", "}", "else", "{", "if", "(", "isIE7", ")", "{", "// FIXME: find a way to put a button also on IE7", "// on IE7 the button is having display issues the current frame implementation inside it", "out", ".", "write", "(", "[", "'<span class=\"'", "+", "buttonClass", "+", "'\" style=\"margin: 0;\"'", ",", "waiAriaAttributes", ",", "tabIndexString", ",", "titleString", ",", "ariaTestMode", ",", "'>'", "]", ".", "join", "(", "''", ")", ")", ";", "}", "else", "{", "out", ".", "write", "(", "[", "'<button'", ",", "' type=\"button\"'", ",", "' class=\"'", "+", "buttonClass", "+", "'\"'", ",", "waiAriaAttributes", ",", "tabIndexString", ",", "titleString", ",", "ariaTestMode", ",", "disableMarkup", ",", "'>'", "]", ".", "join", "(", "''", ")", ")", ";", "}", "this", ".", "_frame", ".", "writeMarkupBegin", "(", "out", ")", ";", "// call the method to write the content of the button - here is is just", "// the label cfg attribute, but the method can be overwritten in child classes", "this", ".", "_widgetMarkupContent", "(", "out", ")", ";", "this", ".", "_frame", ".", "writeMarkupEnd", "(", "out", ")", ";", "if", "(", "isIE7", ")", "{", "out", ".", "write", "(", "'</span>'", ")", ";", "}", "else", "{", "out", ".", "write", "(", "'</button>'", ")", ";", "}", "}", "}" ]
Create the button markup from the Div class @param {aria.templates.MarkupWriter} out Output markup writer @protected
[ "Create", "the", "button", "markup", "from", "the", "Div", "class" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/Button.js#L215-L280
27,314
ariatemplates/ariatemplates
src/aria/widgets/action/Button.js
function (domEvt) { if (domEvt.keyCode == ariaDomEvent.KC_SPACE || domEvt.keyCode == ariaDomEvent.KC_ENTER) { this._keyPressed = true; this._updateState(); domEvt.stopPropagation(); return false; } return true; }
javascript
function (domEvt) { if (domEvt.keyCode == ariaDomEvent.KC_SPACE || domEvt.keyCode == ariaDomEvent.KC_ENTER) { this._keyPressed = true; this._updateState(); domEvt.stopPropagation(); return false; } return true; }
[ "function", "(", "domEvt", ")", "{", "if", "(", "domEvt", ".", "keyCode", "==", "ariaDomEvent", ".", "KC_SPACE", "||", "domEvt", ".", "keyCode", "==", "ariaDomEvent", ".", "KC_ENTER", ")", "{", "this", ".", "_keyPressed", "=", "true", ";", "this", ".", "_updateState", "(", ")", ";", "domEvt", ".", "stopPropagation", "(", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
React to delegated key down events @protected @param {aria.DomEvent} domEvt Event
[ "React", "to", "delegated", "key", "down", "events" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/Button.js#L376-L385
27,315
ariatemplates/ariatemplates
src/aria/utils/Device.js
function() { var parts = [ this.vendor(), this.model() ]; for (var index = parts.length - 1; index >= 0; index--) { var part = parts[index]; if (part == null || part.length == null || part.length <= 0) { parts.splice(index, 1); } } var deviceName = parts.join(" - "); return deviceName; }
javascript
function() { var parts = [ this.vendor(), this.model() ]; for (var index = parts.length - 1; index >= 0; index--) { var part = parts[index]; if (part == null || part.length == null || part.length <= 0) { parts.splice(index, 1); } } var deviceName = parts.join(" - "); return deviceName; }
[ "function", "(", ")", "{", "var", "parts", "=", "[", "this", ".", "vendor", "(", ")", ",", "this", ".", "model", "(", ")", "]", ";", "for", "(", "var", "index", "=", "parts", ".", "length", "-", "1", ";", "index", ">=", "0", ";", "index", "--", ")", "{", "var", "part", "=", "parts", "[", "index", "]", ";", "if", "(", "part", "==", "null", "||", "part", ".", "length", "==", "null", "||", "part", ".", "length", "<=", "0", ")", "{", "parts", ".", "splice", "(", "index", ",", "1", ")", ";", "}", "}", "var", "deviceName", "=", "parts", ".", "join", "(", "\" - \"", ")", ";", "return", "deviceName", ";", "}" ]
Returns the device name, which is a mix of model and vendor properties when available. <p> The format is the following: <em>vendor - model</em> </p> @return {String} The device name or an empty string if no information at all is available
[ "Returns", "the", "device", "name", "which", "is", "a", "mix", "of", "model", "and", "vendor", "properties", "when", "available", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Device.js#L342-L358
27,316
ariatemplates/ariatemplates
src/aria/utils/Device.js
function () { // -------------------------------------------- result initial value var result = false; // -------------------------------------------------- standard check var deviceType = this.__userAgentWrapper.results.device.type; if (!result) { if (deviceType != null) { result = UserAgent.normalizeName(deviceType) == "mobile"; } } // --------------------------------------------------- special cases if (!result) { if (!this.isTablet()) { result = ariaCoreBrowser.isAndroid || ariaCoreBrowser.isBlackBerry || ariaCoreBrowser.isIOS || ariaCoreBrowser.isSymbian || ariaCoreBrowser.isWindowsPhone || UserAgent.normalizeName(ariaCoreBrowser.osName) == "webos" ; } } // ---------------------------------------------------------- result return !!result; }
javascript
function () { // -------------------------------------------- result initial value var result = false; // -------------------------------------------------- standard check var deviceType = this.__userAgentWrapper.results.device.type; if (!result) { if (deviceType != null) { result = UserAgent.normalizeName(deviceType) == "mobile"; } } // --------------------------------------------------- special cases if (!result) { if (!this.isTablet()) { result = ariaCoreBrowser.isAndroid || ariaCoreBrowser.isBlackBerry || ariaCoreBrowser.isIOS || ariaCoreBrowser.isSymbian || ariaCoreBrowser.isWindowsPhone || UserAgent.normalizeName(ariaCoreBrowser.osName) == "webos" ; } } // ---------------------------------------------------------- result return !!result; }
[ "function", "(", ")", "{", "// -------------------------------------------- result initial value", "var", "result", "=", "false", ";", "// -------------------------------------------------- standard check", "var", "deviceType", "=", "this", ".", "__userAgentWrapper", ".", "results", ".", "device", ".", "type", ";", "if", "(", "!", "result", ")", "{", "if", "(", "deviceType", "!=", "null", ")", "{", "result", "=", "UserAgent", ".", "normalizeName", "(", "deviceType", ")", "==", "\"mobile\"", ";", "}", "}", "// --------------------------------------------------- special cases", "if", "(", "!", "result", ")", "{", "if", "(", "!", "this", ".", "isTablet", "(", ")", ")", "{", "result", "=", "ariaCoreBrowser", ".", "isAndroid", "||", "ariaCoreBrowser", ".", "isBlackBerry", "||", "ariaCoreBrowser", ".", "isIOS", "||", "ariaCoreBrowser", ".", "isSymbian", "||", "ariaCoreBrowser", ".", "isWindowsPhone", "||", "UserAgent", ".", "normalizeName", "(", "ariaCoreBrowser", ".", "osName", ")", "==", "\"webos\"", ";", "}", "}", "// ---------------------------------------------------------- result", "return", "!", "!", "result", ";", "}" ]
Checks whether it is a phone device rather than a tablet. <p> We consider that if a mobile operating system is detected but nothing tells that is is a tablet, by default the device is a mobile phone. </p> @return {Boolean} <em>true</em> if so, <em>false</em> otherwise
[ "Checks", "whether", "it", "is", "a", "phone", "device", "rather", "than", "a", "tablet", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Device.js#L369-L401
27,317
ariatemplates/ariatemplates
src/aria/utils/Device.js
function () { var isTouch = false; if (ariaCoreBrowser.isBlackBerry) { if (!ariaUtilsArray.contains([9670, 9100, 9105, 9360, 9350, 9330, 9320, 9310, 9300, 9220, 9780, 9700, 9650], +this.model())) { isTouch = true; } } else { var window = Aria.$window; if (('ontouchstart' in window) || window.DocumentTouch && window.document instanceof window.DocumentTouch) { isTouch = true; } } return !!isTouch; }
javascript
function () { var isTouch = false; if (ariaCoreBrowser.isBlackBerry) { if (!ariaUtilsArray.contains([9670, 9100, 9105, 9360, 9350, 9330, 9320, 9310, 9300, 9220, 9780, 9700, 9650], +this.model())) { isTouch = true; } } else { var window = Aria.$window; if (('ontouchstart' in window) || window.DocumentTouch && window.document instanceof window.DocumentTouch) { isTouch = true; } } return !!isTouch; }
[ "function", "(", ")", "{", "var", "isTouch", "=", "false", ";", "if", "(", "ariaCoreBrowser", ".", "isBlackBerry", ")", "{", "if", "(", "!", "ariaUtilsArray", ".", "contains", "(", "[", "9670", ",", "9100", ",", "9105", ",", "9360", ",", "9350", ",", "9330", ",", "9320", ",", "9310", ",", "9300", ",", "9220", ",", "9780", ",", "9700", ",", "9650", "]", ",", "+", "this", ".", "model", "(", ")", ")", ")", "{", "isTouch", "=", "true", ";", "}", "}", "else", "{", "var", "window", "=", "Aria", ".", "$window", ";", "if", "(", "(", "'ontouchstart'", "in", "window", ")", "||", "window", ".", "DocumentTouch", "&&", "window", ".", "document", "instanceof", "window", ".", "DocumentTouch", ")", "{", "isTouch", "=", "true", ";", "}", "}", "return", "!", "!", "isTouch", ";", "}" ]
Checks whether it is a touch device. @return {Boolean} <em>true</em> if so, <em>false</em> otherwise
[ "Checks", "whether", "it", "is", "a", "touch", "device", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Device.js#L471-L487
27,318
ariatemplates/ariatemplates
src/aria/utils/StackHashMap.js
function () { __objCount++; /** * Counter to be used as an index in each map. Is incremented each time a new entry is added to the object. * @protected * @type Number */ this._nextIndex = 0; /** * Map to store entries whose keys are of type object or function. Note that, even if null is of type * object, it cannot store properties, and for this reason, an entry whose key is null is not stored here, * but in this._otherKeys. * @protected * @type Object */ this._objectKeys = null; /** * Map to store entries whose keys are of type string. * @protected * @type Object */ this._stringKeys = null; /** * Map to store entries whose keys are of type number. * @protected * @type Object */ this._numberKeys = null; /** * Map to store entries whose keys are neither objects (with the exception of null), nor functions, nor * strings, nor numbers. Sample values for keys here: null and undefined (and maybe some other strange * type). For keys in that category, performances are very bad (must iterate over the whole _otherKeys stuff * to find a key). * @protected * @type Object */ this._otherKeys = null; /** * Name of the metadata to use when storing information in object keys. It must be unique. * @protected * @type String */ this._metaDataName = Aria.FRAMEWORK_PREFIX + "hash::" + __objCount; }
javascript
function () { __objCount++; /** * Counter to be used as an index in each map. Is incremented each time a new entry is added to the object. * @protected * @type Number */ this._nextIndex = 0; /** * Map to store entries whose keys are of type object or function. Note that, even if null is of type * object, it cannot store properties, and for this reason, an entry whose key is null is not stored here, * but in this._otherKeys. * @protected * @type Object */ this._objectKeys = null; /** * Map to store entries whose keys are of type string. * @protected * @type Object */ this._stringKeys = null; /** * Map to store entries whose keys are of type number. * @protected * @type Object */ this._numberKeys = null; /** * Map to store entries whose keys are neither objects (with the exception of null), nor functions, nor * strings, nor numbers. Sample values for keys here: null and undefined (and maybe some other strange * type). For keys in that category, performances are very bad (must iterate over the whole _otherKeys stuff * to find a key). * @protected * @type Object */ this._otherKeys = null; /** * Name of the metadata to use when storing information in object keys. It must be unique. * @protected * @type String */ this._metaDataName = Aria.FRAMEWORK_PREFIX + "hash::" + __objCount; }
[ "function", "(", ")", "{", "__objCount", "++", ";", "/**\n * Counter to be used as an index in each map. Is incremented each time a new entry is added to the object.\n * @protected\n * @type Number\n */", "this", ".", "_nextIndex", "=", "0", ";", "/**\n * Map to store entries whose keys are of type object or function. Note that, even if null is of type\n * object, it cannot store properties, and for this reason, an entry whose key is null is not stored here,\n * but in this._otherKeys.\n * @protected\n * @type Object\n */", "this", ".", "_objectKeys", "=", "null", ";", "/**\n * Map to store entries whose keys are of type string.\n * @protected\n * @type Object\n */", "this", ".", "_stringKeys", "=", "null", ";", "/**\n * Map to store entries whose keys are of type number.\n * @protected\n * @type Object\n */", "this", ".", "_numberKeys", "=", "null", ";", "/**\n * Map to store entries whose keys are neither objects (with the exception of null), nor functions, nor\n * strings, nor numbers. Sample values for keys here: null and undefined (and maybe some other strange\n * type). For keys in that category, performances are very bad (must iterate over the whole _otherKeys stuff\n * to find a key).\n * @protected\n * @type Object\n */", "this", ".", "_otherKeys", "=", "null", ";", "/**\n * Name of the metadata to use when storing information in object keys. It must be unique.\n * @protected\n * @type String\n */", "this", ".", "_metaDataName", "=", "Aria", ".", "FRAMEWORK_PREFIX", "+", "\"hash::\"", "+", "__objCount", ";", "}" ]
Create an empty StackHashMap object.
[ "Create", "an", "empty", "StackHashMap", "object", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/StackHashMap.js#L45-L88
27,319
ariatemplates/ariatemplates
src/aria/utils/StackHashMap.js
function (key, value) { var item = { key : key, value : value, index : this._nextIndex }; this._nextIndex++; var map = this._getMap(key, true); if (map == this._objectKeys) { // something special in case of objects: var next = key[this._metaDataName]; if (next) { // the key is already present // keep the old value item.next = next; // keep the index (so that the removal is unified between objects, strings and numbers) item.index = next.index; } key[this._metaDataName] = item; } else if (map != this._otherKeys) { item.index = key; // use the key as index for numbers and strings item.next = map[item.index]; // keep any existing value } else { // we must check for an existing value to define the 'next' property, // so that the order when removing values is the one of a stack for (var i in map) { if (map.hasOwnProperty(i)) { var elt = map[i]; if (key === elt.key) { item.index = i; item.next = elt; break; } } } } map[item.index] = item; }
javascript
function (key, value) { var item = { key : key, value : value, index : this._nextIndex }; this._nextIndex++; var map = this._getMap(key, true); if (map == this._objectKeys) { // something special in case of objects: var next = key[this._metaDataName]; if (next) { // the key is already present // keep the old value item.next = next; // keep the index (so that the removal is unified between objects, strings and numbers) item.index = next.index; } key[this._metaDataName] = item; } else if (map != this._otherKeys) { item.index = key; // use the key as index for numbers and strings item.next = map[item.index]; // keep any existing value } else { // we must check for an existing value to define the 'next' property, // so that the order when removing values is the one of a stack for (var i in map) { if (map.hasOwnProperty(i)) { var elt = map[i]; if (key === elt.key) { item.index = i; item.next = elt; break; } } } } map[item.index] = item; }
[ "function", "(", "key", ",", "value", ")", "{", "var", "item", "=", "{", "key", ":", "key", ",", "value", ":", "value", ",", "index", ":", "this", ".", "_nextIndex", "}", ";", "this", ".", "_nextIndex", "++", ";", "var", "map", "=", "this", ".", "_getMap", "(", "key", ",", "true", ")", ";", "if", "(", "map", "==", "this", ".", "_objectKeys", ")", "{", "// something special in case of objects:", "var", "next", "=", "key", "[", "this", ".", "_metaDataName", "]", ";", "if", "(", "next", ")", "{", "// the key is already present", "// keep the old value", "item", ".", "next", "=", "next", ";", "// keep the index (so that the removal is unified between objects, strings and numbers)", "item", ".", "index", "=", "next", ".", "index", ";", "}", "key", "[", "this", ".", "_metaDataName", "]", "=", "item", ";", "}", "else", "if", "(", "map", "!=", "this", ".", "_otherKeys", ")", "{", "item", ".", "index", "=", "key", ";", "// use the key as index for numbers and strings", "item", ".", "next", "=", "map", "[", "item", ".", "index", "]", ";", "// keep any existing value", "}", "else", "{", "// we must check for an existing value to define the 'next' property,", "// so that the order when removing values is the one of a stack", "for", "(", "var", "i", "in", "map", ")", "{", "if", "(", "map", ".", "hasOwnProperty", "(", "i", ")", ")", "{", "var", "elt", "=", "map", "[", "i", "]", ";", "if", "(", "key", "===", "elt", ".", "key", ")", "{", "item", ".", "index", "=", "i", ";", "item", ".", "next", "=", "elt", ";", "break", ";", "}", "}", "}", "}", "map", "[", "item", ".", "index", "]", "=", "item", ";", "}" ]
Add an entry in the StackHashMap object. @param {MultiTypes} key Key which can be used to retrieve the value later (through the pop method). If the key is already present in the object, the value will be added anyway. @param {MultiTypes} value Anything to store in the StackHashMap object
[ "Add", "an", "entry", "in", "the", "StackHashMap", "object", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/StackHashMap.js#L155-L192
27,320
ariatemplates/ariatemplates
src/aria/utils/StackHashMap.js
function (key) { var map = this._getMap(key, false); if (map == null) { return false; } var item; if (map == this._objectKeys) { item = key[this._metaDataName]; } else if (map != this._otherKeys) { item = map[key]; } else { for (var i in map) { if (map.hasOwnProperty(i)) { var elt = map[i]; if (key === elt.key) { item = elt; break; } } } } if (item) { return true; } else { return false; } }
javascript
function (key) { var map = this._getMap(key, false); if (map == null) { return false; } var item; if (map == this._objectKeys) { item = key[this._metaDataName]; } else if (map != this._otherKeys) { item = map[key]; } else { for (var i in map) { if (map.hasOwnProperty(i)) { var elt = map[i]; if (key === elt.key) { item = elt; break; } } } } if (item) { return true; } else { return false; } }
[ "function", "(", "key", ")", "{", "var", "map", "=", "this", ".", "_getMap", "(", "key", ",", "false", ")", ";", "if", "(", "map", "==", "null", ")", "{", "return", "false", ";", "}", "var", "item", ";", "if", "(", "map", "==", "this", ".", "_objectKeys", ")", "{", "item", "=", "key", "[", "this", ".", "_metaDataName", "]", ";", "}", "else", "if", "(", "map", "!=", "this", ".", "_otherKeys", ")", "{", "item", "=", "map", "[", "key", "]", ";", "}", "else", "{", "for", "(", "var", "i", "in", "map", ")", "{", "if", "(", "map", ".", "hasOwnProperty", "(", "i", ")", ")", "{", "var", "elt", "=", "map", "[", "i", "]", ";", "if", "(", "key", "===", "elt", ".", "key", ")", "{", "item", "=", "elt", ";", "break", ";", "}", "}", "}", "}", "if", "(", "item", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Checks if a key is in the StackHashMap object and returns true if it is found. @param {MultiTypes} key key which was used to add the entry in the StackHashMap object. @return {Boolean} True if there is an entry that was added with the same key.
[ "Checks", "if", "a", "key", "is", "in", "the", "StackHashMap", "object", "and", "returns", "true", "if", "it", "is", "found", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/StackHashMap.js#L199-L225
27,321
ariatemplates/ariatemplates
src/aria/utils/StackHashMap.js
function (key) { var map = this._getMap(key, false); if (map == null) { return undefined; } var item; if (map == this._objectKeys) { item = key[this._metaDataName]; if (item) { key[this._metaDataName] = item.next; if (!item.next) { delete key[this._metaDataName]; } } } else if (map != this._otherKeys) { item = map[key]; } else { for (var i in map) { if (map.hasOwnProperty(i)) { var elt = map[i]; if (key === elt.key) { item = elt; break; } } } } if (item) { var next = item.next; map[item.index] = next; if (!next) { delete map[item.index]; } item.key = null; item.next = null; return item.value; } else { return undefined; } }
javascript
function (key) { var map = this._getMap(key, false); if (map == null) { return undefined; } var item; if (map == this._objectKeys) { item = key[this._metaDataName]; if (item) { key[this._metaDataName] = item.next; if (!item.next) { delete key[this._metaDataName]; } } } else if (map != this._otherKeys) { item = map[key]; } else { for (var i in map) { if (map.hasOwnProperty(i)) { var elt = map[i]; if (key === elt.key) { item = elt; break; } } } } if (item) { var next = item.next; map[item.index] = next; if (!next) { delete map[item.index]; } item.key = null; item.next = null; return item.value; } else { return undefined; } }
[ "function", "(", "key", ")", "{", "var", "map", "=", "this", ".", "_getMap", "(", "key", ",", "false", ")", ";", "if", "(", "map", "==", "null", ")", "{", "return", "undefined", ";", "}", "var", "item", ";", "if", "(", "map", "==", "this", ".", "_objectKeys", ")", "{", "item", "=", "key", "[", "this", ".", "_metaDataName", "]", ";", "if", "(", "item", ")", "{", "key", "[", "this", ".", "_metaDataName", "]", "=", "item", ".", "next", ";", "if", "(", "!", "item", ".", "next", ")", "{", "delete", "key", "[", "this", ".", "_metaDataName", "]", ";", "}", "}", "}", "else", "if", "(", "map", "!=", "this", ".", "_otherKeys", ")", "{", "item", "=", "map", "[", "key", "]", ";", "}", "else", "{", "for", "(", "var", "i", "in", "map", ")", "{", "if", "(", "map", ".", "hasOwnProperty", "(", "i", ")", ")", "{", "var", "elt", "=", "map", "[", "i", "]", ";", "if", "(", "key", "===", "elt", ".", "key", ")", "{", "item", "=", "elt", ";", "break", ";", "}", "}", "}", "}", "if", "(", "item", ")", "{", "var", "next", "=", "item", ".", "next", ";", "map", "[", "item", ".", "index", "]", "=", "next", ";", "if", "(", "!", "next", ")", "{", "delete", "map", "[", "item", ".", "index", "]", ";", "}", "item", ".", "key", "=", "null", ";", "item", ".", "next", "=", "null", ";", "return", "item", ".", "value", ";", "}", "else", "{", "return", "undefined", ";", "}", "}" ]
Remove an entry from the StackHashMap object and return the value. @param {MultiTypes} key key which was used to add the entry in the StackHashMap object. @return {MultiTypes} value associated to the given key. If several entries were added with the same key, return the last one which has not yet been removed (it is a stack).
[ "Remove", "an", "entry", "from", "the", "StackHashMap", "object", "and", "return", "the", "value", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/StackHashMap.js#L233-L272
27,322
ariatemplates/ariatemplates
src/aria/utils/StackHashMap.js
function (map, array) { if (map == null) return; for (var i in map) { var item = map[i]; var key = item.key; if (map == this._objectKeys) { key[this._metaDataName] = null; delete item.key[this._metaDataName]; } while (item) { array.push(item.value); item.value = null; item.key = null; var next = item.next; item.next = null; item = next; } map[i] = null; delete map[i]; } }
javascript
function (map, array) { if (map == null) return; for (var i in map) { var item = map[i]; var key = item.key; if (map == this._objectKeys) { key[this._metaDataName] = null; delete item.key[this._metaDataName]; } while (item) { array.push(item.value); item.value = null; item.key = null; var next = item.next; item.next = null; item = next; } map[i] = null; delete map[i]; } }
[ "function", "(", "map", ",", "array", ")", "{", "if", "(", "map", "==", "null", ")", "return", ";", "for", "(", "var", "i", "in", "map", ")", "{", "var", "item", "=", "map", "[", "i", "]", ";", "var", "key", "=", "item", ".", "key", ";", "if", "(", "map", "==", "this", ".", "_objectKeys", ")", "{", "key", "[", "this", ".", "_metaDataName", "]", "=", "null", ";", "delete", "item", ".", "key", "[", "this", ".", "_metaDataName", "]", ";", "}", "while", "(", "item", ")", "{", "array", ".", "push", "(", "item", ".", "value", ")", ";", "item", ".", "value", "=", "null", ";", "item", ".", "key", "=", "null", ";", "var", "next", "=", "item", ".", "next", ";", "item", ".", "next", "=", "null", ";", "item", "=", "next", ";", "}", "map", "[", "i", "]", "=", "null", ";", "delete", "map", "[", "i", "]", ";", "}", "}" ]
Remove all the entries of the given map and put the corresponding values in the given array. @private @param {Object} map of entries to be emptied @param {Array} array which will receive the values
[ "Remove", "all", "the", "entries", "of", "the", "given", "map", "and", "put", "the", "corresponding", "values", "in", "the", "given", "array", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/StackHashMap.js#L280-L301
27,323
ariatemplates/ariatemplates
src/aria/utils/StackHashMap.js
function () { var res = []; this._removeAllToArray(this._objectKeys, res); this._objectKeys = null; this._removeAllToArray(this._stringKeys, res); this._stringKeys = null; this._removeAllToArray(this._numberKeys, res); this._numberKeys = null; this._removeAllToArray(this._otherKeys, res); this._otherKeys = null; return res; }
javascript
function () { var res = []; this._removeAllToArray(this._objectKeys, res); this._objectKeys = null; this._removeAllToArray(this._stringKeys, res); this._stringKeys = null; this._removeAllToArray(this._numberKeys, res); this._numberKeys = null; this._removeAllToArray(this._otherKeys, res); this._otherKeys = null; return res; }
[ "function", "(", ")", "{", "var", "res", "=", "[", "]", ";", "this", ".", "_removeAllToArray", "(", "this", ".", "_objectKeys", ",", "res", ")", ";", "this", ".", "_objectKeys", "=", "null", ";", "this", ".", "_removeAllToArray", "(", "this", ".", "_stringKeys", ",", "res", ")", ";", "this", ".", "_stringKeys", "=", "null", ";", "this", ".", "_removeAllToArray", "(", "this", ".", "_numberKeys", ",", "res", ")", ";", "this", ".", "_numberKeys", "=", "null", ";", "this", ".", "_removeAllToArray", "(", "this", ".", "_otherKeys", ",", "res", ")", ";", "this", ".", "_otherKeys", "=", "null", ";", "return", "res", ";", "}" ]
Remove all the entries of the StackHashMap object and return the corresponding values. @return {Array} array of all the values present in the StackHashMap object
[ "Remove", "all", "the", "entries", "of", "the", "StackHashMap", "object", "and", "return", "the", "corresponding", "values", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/StackHashMap.js#L307-L318
27,324
ariatemplates/ariatemplates
src/aria/core/transport/XDR.js
function (reqId, callback) { // PROFILING // this.$stopMeasure(req.profilingId); // Check if Flash plugin is available var navigator = Aria.$global.navigator; if (navigator.plugins && navigator.plugins.length > 0) { var mime = navigator.mimeTypes, type = "application/x-shockwave-flash"; if (!mime || !mime[type] || !mime[type].enabledPlugin) { return this.$logError(this.IO_MISSING_FLASH_PLUGIN); } } else if (navigator.appVersion.indexOf("Mac") == -1 && Aria.$frameworkWindow.execScript) { try { var ActiveXObject = Aria.$global.ActiveXObject; var obj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); if (obj.activeXError) { throw "ActiveXError"; } } catch (er) { return this.$logError(this.IO_MISSING_FLASH_PLUGIN); } } // We're not ready, wait for the ready event to reissue the request, but cancel this request on timeout this._pending[reqId] = ariaCoreTimer.addCallback({ fn : this._swfTimeout, scope : this, args : { reqId : reqId, cb : callback }, delay : this.swfTimeout }); if (!this._transport) { var swfUri = ariaCoreDownloadMgr.resolveURL('aria/resources/handlers/IO.swf'); // note that the flash transport does not work with Safari if the following line is present in // parameters: // '<param name="wmode" value="transparent"/>' var obj = [ '<object id="xATIOSwf" type="application/x-shockwave-flash" data="', swfUri, '" width="1" height="1">', '<param name="movie" value="' + swfUri + '" />', '<param name="allowScriptAccess" value="always" />', '<param name="FlashVars" value="readyCallback=' + this.$classpath + '.onXdrReady&handler=' + this.$classpath + '.handleXdrResponse" />', '</object>'].join(""); var document = Aria.$frameworkWindow.document; var container = document.createElement('div'); container.style.cssText = "position:fixed;top:-12000px;left:-12000px"; document.body.appendChild(container); container.innerHTML = obj; this._transport = document.getElementById("xATIOSwf"); this._transportContainer = container; } }
javascript
function (reqId, callback) { // PROFILING // this.$stopMeasure(req.profilingId); // Check if Flash plugin is available var navigator = Aria.$global.navigator; if (navigator.plugins && navigator.plugins.length > 0) { var mime = navigator.mimeTypes, type = "application/x-shockwave-flash"; if (!mime || !mime[type] || !mime[type].enabledPlugin) { return this.$logError(this.IO_MISSING_FLASH_PLUGIN); } } else if (navigator.appVersion.indexOf("Mac") == -1 && Aria.$frameworkWindow.execScript) { try { var ActiveXObject = Aria.$global.ActiveXObject; var obj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); if (obj.activeXError) { throw "ActiveXError"; } } catch (er) { return this.$logError(this.IO_MISSING_FLASH_PLUGIN); } } // We're not ready, wait for the ready event to reissue the request, but cancel this request on timeout this._pending[reqId] = ariaCoreTimer.addCallback({ fn : this._swfTimeout, scope : this, args : { reqId : reqId, cb : callback }, delay : this.swfTimeout }); if (!this._transport) { var swfUri = ariaCoreDownloadMgr.resolveURL('aria/resources/handlers/IO.swf'); // note that the flash transport does not work with Safari if the following line is present in // parameters: // '<param name="wmode" value="transparent"/>' var obj = [ '<object id="xATIOSwf" type="application/x-shockwave-flash" data="', swfUri, '" width="1" height="1">', '<param name="movie" value="' + swfUri + '" />', '<param name="allowScriptAccess" value="always" />', '<param name="FlashVars" value="readyCallback=' + this.$classpath + '.onXdrReady&handler=' + this.$classpath + '.handleXdrResponse" />', '</object>'].join(""); var document = Aria.$frameworkWindow.document; var container = document.createElement('div'); container.style.cssText = "position:fixed;top:-12000px;left:-12000px"; document.body.appendChild(container); container.innerHTML = obj; this._transport = document.getElementById("xATIOSwf"); this._transportContainer = container; } }
[ "function", "(", "reqId", ",", "callback", ")", "{", "// PROFILING // this.$stopMeasure(req.profilingId);", "// Check if Flash plugin is available", "var", "navigator", "=", "Aria", ".", "$global", ".", "navigator", ";", "if", "(", "navigator", ".", "plugins", "&&", "navigator", ".", "plugins", ".", "length", ">", "0", ")", "{", "var", "mime", "=", "navigator", ".", "mimeTypes", ",", "type", "=", "\"application/x-shockwave-flash\"", ";", "if", "(", "!", "mime", "||", "!", "mime", "[", "type", "]", "||", "!", "mime", "[", "type", "]", ".", "enabledPlugin", ")", "{", "return", "this", ".", "$logError", "(", "this", ".", "IO_MISSING_FLASH_PLUGIN", ")", ";", "}", "}", "else", "if", "(", "navigator", ".", "appVersion", ".", "indexOf", "(", "\"Mac\"", ")", "==", "-", "1", "&&", "Aria", ".", "$frameworkWindow", ".", "execScript", ")", "{", "try", "{", "var", "ActiveXObject", "=", "Aria", ".", "$global", ".", "ActiveXObject", ";", "var", "obj", "=", "new", "ActiveXObject", "(", "\"ShockwaveFlash.ShockwaveFlash\"", ")", ";", "if", "(", "obj", ".", "activeXError", ")", "{", "throw", "\"ActiveXError\"", ";", "}", "}", "catch", "(", "er", ")", "{", "return", "this", ".", "$logError", "(", "this", ".", "IO_MISSING_FLASH_PLUGIN", ")", ";", "}", "}", "// We're not ready, wait for the ready event to reissue the request, but cancel this request on timeout", "this", ".", "_pending", "[", "reqId", "]", "=", "ariaCoreTimer", ".", "addCallback", "(", "{", "fn", ":", "this", ".", "_swfTimeout", ",", "scope", ":", "this", ",", "args", ":", "{", "reqId", ":", "reqId", ",", "cb", ":", "callback", "}", ",", "delay", ":", "this", ".", "swfTimeout", "}", ")", ";", "if", "(", "!", "this", ".", "_transport", ")", "{", "var", "swfUri", "=", "ariaCoreDownloadMgr", ".", "resolveURL", "(", "'aria/resources/handlers/IO.swf'", ")", ";", "// note that the flash transport does not work with Safari if the following line is present in", "// parameters:", "// '<param name=\"wmode\" value=\"transparent\"/>'", "var", "obj", "=", "[", "'<object id=\"xATIOSwf\" type=\"application/x-shockwave-flash\" data=\"'", ",", "swfUri", ",", "'\" width=\"1\" height=\"1\">'", ",", "'<param name=\"movie\" value=\"'", "+", "swfUri", "+", "'\" />'", ",", "'<param name=\"allowScriptAccess\" value=\"always\" />'", ",", "'<param name=\"FlashVars\" value=\"readyCallback='", "+", "this", ".", "$classpath", "+", "'.onXdrReady&handler='", "+", "this", ".", "$classpath", "+", "'.handleXdrResponse\" />'", ",", "'</object>'", "]", ".", "join", "(", "\"\"", ")", ";", "var", "document", "=", "Aria", ".", "$frameworkWindow", ".", "document", ";", "var", "container", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "container", ".", "style", ".", "cssText", "=", "\"position:fixed;top:-12000px;left:-12000px\"", ";", "document", ".", "body", ".", "appendChild", "(", "container", ")", ";", "container", ".", "innerHTML", "=", "obj", ";", "this", ".", "_transport", "=", "document", ".", "getElementById", "(", "\"xATIOSwf\"", ")", ";", "this", ".", "_transportContainer", "=", "container", ";", "}", "}" ]
Inizialization function. @param {String} reqId Request identifier @param {aria.core.CfgBeans:Callback} callback This callback is generated by IO so it's already normalized
[ "Inizialization", "function", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/transport/XDR.js#L94-L151
27,325
ariatemplates/ariatemplates
src/aria/core/transport/XDR.js
function () { this.isReady = true; for (var id in this._pending) { if (this._pending.hasOwnProperty(id)) { ariaCoreTimer.cancelCallback(this._pending[id]); ariaCoreIO.reissue(id); } } this._pending = {}; }
javascript
function () { this.isReady = true; for (var id in this._pending) { if (this._pending.hasOwnProperty(id)) { ariaCoreTimer.cancelCallback(this._pending[id]); ariaCoreIO.reissue(id); } } this._pending = {}; }
[ "function", "(", ")", "{", "this", ".", "isReady", "=", "true", ";", "for", "(", "var", "id", "in", "this", ".", "_pending", ")", "{", "if", "(", "this", ".", "_pending", ".", "hasOwnProperty", "(", "id", ")", ")", "{", "ariaCoreTimer", ".", "cancelCallback", "(", "this", ".", "_pending", "[", "id", "]", ")", ";", "ariaCoreIO", ".", "reissue", "(", "id", ")", ";", "}", "}", "this", ".", "_pending", "=", "{", "}", ";", "}" ]
Callback called by flash transport once initialized, causes a reissue of the requests that were queued while the transport was initializing
[ "Callback", "called", "by", "flash", "transport", "once", "initialized", "causes", "a", "reissue", "of", "the", "requests", "that", "were", "queued", "while", "the", "transport", "was", "initializing" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/transport/XDR.js#L157-L167
27,326
ariatemplates/ariatemplates
src/aria/core/transport/XDR.js
function (args) { var reqId = args.reqId; var callback = args.cb; delete this._pending[reqId]; var response = { error : this.LOAD_PLUGIN, status : 0 }; callback.fn.call(callback.scope, true, callback.args, response); }
javascript
function (args) { var reqId = args.reqId; var callback = args.cb; delete this._pending[reqId]; var response = { error : this.LOAD_PLUGIN, status : 0 }; callback.fn.call(callback.scope, true, callback.args, response); }
[ "function", "(", "args", ")", "{", "var", "reqId", "=", "args", ".", "reqId", ";", "var", "callback", "=", "args", ".", "cb", ";", "delete", "this", ".", "_pending", "[", "reqId", "]", ";", "var", "response", "=", "{", "error", ":", "this", ".", "LOAD_PLUGIN", ",", "status", ":", "0", "}", ";", "callback", ".", "fn", ".", "call", "(", "callback", ".", "scope", ",", "true", ",", "callback", ".", "args", ",", "response", ")", ";", "}" ]
Timeout called when flash transport initialized fails, causes an abort of the request. @protected @param {Object} args Object containing request and callback objects
[ "Timeout", "called", "when", "flash", "transport", "initialized", "fails", "causes", "an", "abort", "of", "the", "request", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/transport/XDR.js#L174-L186
27,327
ariatemplates/ariatemplates
src/aria/core/transport/XDR.js
function (connection) { if (connection) { // raise global custom event -- startEvent ariaCoreIO.$raiseEvent({ name : "startEvent", o : connection }); if (connection.startEvent) { // raise transaction custom event -- startEvent ariaCoreIO.$raiseEvent({ name : connection.startEvent, o : connection }); } } }
javascript
function (connection) { if (connection) { // raise global custom event -- startEvent ariaCoreIO.$raiseEvent({ name : "startEvent", o : connection }); if (connection.startEvent) { // raise transaction custom event -- startEvent ariaCoreIO.$raiseEvent({ name : connection.startEvent, o : connection }); } } }
[ "function", "(", "connection", ")", "{", "if", "(", "connection", ")", "{", "// raise global custom event -- startEvent", "ariaCoreIO", ".", "$raiseEvent", "(", "{", "name", ":", "\"startEvent\"", ",", "o", ":", "connection", "}", ")", ";", "if", "(", "connection", ".", "startEvent", ")", "{", "// raise transaction custom event -- startEvent", "ariaCoreIO", ".", "$raiseEvent", "(", "{", "name", ":", "connection", ".", "startEvent", ",", "o", ":", "connection", "}", ")", ";", "}", "}", "}" ]
Raises the global and transaction start events. @protected @param {Object} connection The transaction object.
[ "Raises", "the", "global", "and", "transaction", "start", "events", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/transport/XDR.js#L243-L259
27,328
ariatemplates/ariatemplates
src/aria/core/transport/XDR.js
function (reqId, connection, callback) { var success = connection && connection.statusText === "xdr:success"; if (success) { connection.status = 200; } else { connection.status = 0; } callback.fn.call(callback.scope, !success, callback.args, connection); }
javascript
function (reqId, connection, callback) { var success = connection && connection.statusText === "xdr:success"; if (success) { connection.status = 200; } else { connection.status = 0; } callback.fn.call(callback.scope, !success, callback.args, connection); }
[ "function", "(", "reqId", ",", "connection", ",", "callback", ")", "{", "var", "success", "=", "connection", "&&", "connection", ".", "statusText", "===", "\"xdr:success\"", ";", "if", "(", "success", ")", "{", "connection", ".", "status", "=", "200", ";", "}", "else", "{", "connection", ".", "status", "=", "0", ";", "}", "callback", ".", "fn", ".", "call", "(", "callback", ".", "scope", ",", "!", "success", ",", "callback", ".", "args", ",", "connection", ")", ";", "}" ]
Attempts to interpret the flash response and determine whether the transaction was successful, or if an error or exception was encountered. @private @param {Number} reqId Requst identifier @param {Object} connection The connection object (XHR or ActiveX) @param {aria.core.CfgBeans:Callback} callback Callback from aria.core.IO
[ "Attempts", "to", "interpret", "the", "flash", "response", "and", "determine", "whether", "the", "transaction", "was", "successful", "or", "if", "an", "error", "or", "exception", "was", "encountered", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/transport/XDR.js#L269-L279
27,329
ariatemplates/ariatemplates
src/aria/core/IO.js
function (unused, req) { this.$raiseEvent({ name : "request", req : req }); req.beginDownload = (new Date()).getTime(); // as postData can possibly be changed by filters, we compute the requestSize only after filters have been // called: req.requestSize = ((req.method == "POST" || req.method == "PUT") && req.data) ? req.data.length : 0; // PROFILING // req.profilingId = this.$startMeasure(req.url); try { this._prepareTransport(req); } catch (ex) { // There was an error in this method - let's create a callback to notify // the caller in the same way as for other errors (require("./Timer")).addCallback({ fn : this._handleResponse, scope : this, delay : 10, args : { isInternalError : true, reqId : req.id, errDescription : ex.description || ex.message || (ex.name + ex.number) } }); } return req.id; }
javascript
function (unused, req) { this.$raiseEvent({ name : "request", req : req }); req.beginDownload = (new Date()).getTime(); // as postData can possibly be changed by filters, we compute the requestSize only after filters have been // called: req.requestSize = ((req.method == "POST" || req.method == "PUT") && req.data) ? req.data.length : 0; // PROFILING // req.profilingId = this.$startMeasure(req.url); try { this._prepareTransport(req); } catch (ex) { // There was an error in this method - let's create a callback to notify // the caller in the same way as for other errors (require("./Timer")).addCallback({ fn : this._handleResponse, scope : this, delay : 10, args : { isInternalError : true, reqId : req.id, errDescription : ex.description || ex.message || (ex.name + ex.number) } }); } return req.id; }
[ "function", "(", "unused", ",", "req", ")", "{", "this", ".", "$raiseEvent", "(", "{", "name", ":", "\"request\"", ",", "req", ":", "req", "}", ")", ";", "req", ".", "beginDownload", "=", "(", "new", "Date", "(", ")", ")", ".", "getTime", "(", ")", ";", "// as postData can possibly be changed by filters, we compute the requestSize only after filters have been", "// called:", "req", ".", "requestSize", "=", "(", "(", "req", ".", "method", "==", "\"POST\"", "||", "req", ".", "method", "==", "\"PUT\"", ")", "&&", "req", ".", "data", ")", "?", "req", ".", "data", ".", "length", ":", "0", ";", "// PROFILING // req.profilingId = this.$startMeasure(req.url);", "try", "{", "this", ".", "_prepareTransport", "(", "req", ")", ";", "}", "catch", "(", "ex", ")", "{", "// There was an error in this method - let's create a callback to notify", "// the caller in the same way as for other errors", "(", "require", "(", "\"./Timer\"", ")", ")", ".", "addCallback", "(", "{", "fn", ":", "this", ".", "_handleResponse", ",", "scope", ":", "this", ",", "delay", ":", "10", ",", "args", ":", "{", "isInternalError", ":", "true", ",", "reqId", ":", "req", ".", "id", ",", "errDescription", ":", "ex", ".", "description", "||", "ex", ".", "message", "||", "(", "ex", ".", "name", "+", "ex", ".", "number", ")", "}", "}", ")", ";", "}", "return", "req", ".", "id", ";", "}" ]
Continue the request started in asyncRequest, after request filters have been called. @param {Object} unused Unused parameter @param {aria.core.CfgBeans:IOAsyncRequestCfg} req request (may have been modified by filters) @private
[ "Continue", "the", "request", "started", "in", "asyncRequest", "after", "request", "filters", "have", "been", "called", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IO.js#L366-L398
27,330
ariatemplates/ariatemplates
src/aria/core/IO.js
function (req) { // increment before assigning to avoid setting request id 0 (which does not work well with abort) this.nbRequests++; req.id = this.nbRequests; var reqMethods = ["GET", "POST", "PUT", "DELETE", "HEAD", "TRACE", "OPTIONS", "CONNECT", "PATCH", "COPY", "PROPFIND", "MKCOL", "PROPPATCH", "MOVE", "LOCK", "UNLOCK", "BIND", "UNBIND", "REBIND"]; // Assign a request timeout in order of importance: // # req.timeout - User specified timeout // # req.callback.timeout - Timeout of the callback function (might be set by filters) // # this.defaultTimeout - Default IO timeout if (req.timeout == null) { req.timeout = (req.callback == null || req.callback.timeout == null) ? this.defaultTimeout : req.callback.timeout; } if (!req.method) { req.method = "GET"; } else { req.method = req.method.toUpperCase(); } if (!(require("../utils/Array")).contains(reqMethods, req.method)) { return this.$logWarn("The request method %1 is invalid", [req.method]); } var headers = {}; // First take the default IO headers for (var key in this.headers) { if (this.headers.hasOwnProperty(key)) { headers[key] = this.headers[key]; } } // Then add POST/PUT-specific headers if (req.method === "POST" || req.method === "PUT") { for (var key in this.postHeaders) { if (this.postHeaders.hasOwnProperty(key)) { headers[key] = this.postHeaders[key]; } } } // Then the headers from the request object for (var key in req.headers) { if (req.headers.hasOwnProperty(key)) { headers[key] = req.headers[key]; } } req.headers = headers; }
javascript
function (req) { // increment before assigning to avoid setting request id 0 (which does not work well with abort) this.nbRequests++; req.id = this.nbRequests; var reqMethods = ["GET", "POST", "PUT", "DELETE", "HEAD", "TRACE", "OPTIONS", "CONNECT", "PATCH", "COPY", "PROPFIND", "MKCOL", "PROPPATCH", "MOVE", "LOCK", "UNLOCK", "BIND", "UNBIND", "REBIND"]; // Assign a request timeout in order of importance: // # req.timeout - User specified timeout // # req.callback.timeout - Timeout of the callback function (might be set by filters) // # this.defaultTimeout - Default IO timeout if (req.timeout == null) { req.timeout = (req.callback == null || req.callback.timeout == null) ? this.defaultTimeout : req.callback.timeout; } if (!req.method) { req.method = "GET"; } else { req.method = req.method.toUpperCase(); } if (!(require("../utils/Array")).contains(reqMethods, req.method)) { return this.$logWarn("The request method %1 is invalid", [req.method]); } var headers = {}; // First take the default IO headers for (var key in this.headers) { if (this.headers.hasOwnProperty(key)) { headers[key] = this.headers[key]; } } // Then add POST/PUT-specific headers if (req.method === "POST" || req.method === "PUT") { for (var key in this.postHeaders) { if (this.postHeaders.hasOwnProperty(key)) { headers[key] = this.postHeaders[key]; } } } // Then the headers from the request object for (var key in req.headers) { if (req.headers.hasOwnProperty(key)) { headers[key] = req.headers[key]; } } req.headers = headers; }
[ "function", "(", "req", ")", "{", "// increment before assigning to avoid setting request id 0 (which does not work well with abort)", "this", ".", "nbRequests", "++", ";", "req", ".", "id", "=", "this", ".", "nbRequests", ";", "var", "reqMethods", "=", "[", "\"GET\"", ",", "\"POST\"", ",", "\"PUT\"", ",", "\"DELETE\"", ",", "\"HEAD\"", ",", "\"TRACE\"", ",", "\"OPTIONS\"", ",", "\"CONNECT\"", ",", "\"PATCH\"", ",", "\"COPY\"", ",", "\"PROPFIND\"", ",", "\"MKCOL\"", ",", "\"PROPPATCH\"", ",", "\"MOVE\"", ",", "\"LOCK\"", ",", "\"UNLOCK\"", ",", "\"BIND\"", ",", "\"UNBIND\"", ",", "\"REBIND\"", "]", ";", "// Assign a request timeout in order of importance:", "// # req.timeout - User specified timeout", "// # req.callback.timeout - Timeout of the callback function (might be set by filters)", "// # this.defaultTimeout - Default IO timeout", "if", "(", "req", ".", "timeout", "==", "null", ")", "{", "req", ".", "timeout", "=", "(", "req", ".", "callback", "==", "null", "||", "req", ".", "callback", ".", "timeout", "==", "null", ")", "?", "this", ".", "defaultTimeout", ":", "req", ".", "callback", ".", "timeout", ";", "}", "if", "(", "!", "req", ".", "method", ")", "{", "req", ".", "method", "=", "\"GET\"", ";", "}", "else", "{", "req", ".", "method", "=", "req", ".", "method", ".", "toUpperCase", "(", ")", ";", "}", "if", "(", "!", "(", "require", "(", "\"../utils/Array\"", ")", ")", ".", "contains", "(", "reqMethods", ",", "req", ".", "method", ")", ")", "{", "return", "this", ".", "$logWarn", "(", "\"The request method %1 is invalid\"", ",", "[", "req", ".", "method", "]", ")", ";", "}", "var", "headers", "=", "{", "}", ";", "// First take the default IO headers", "for", "(", "var", "key", "in", "this", ".", "headers", ")", "{", "if", "(", "this", ".", "headers", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "headers", "[", "key", "]", "=", "this", ".", "headers", "[", "key", "]", ";", "}", "}", "// Then add POST/PUT-specific headers", "if", "(", "req", ".", "method", "===", "\"POST\"", "||", "req", ".", "method", "===", "\"PUT\"", ")", "{", "for", "(", "var", "key", "in", "this", ".", "postHeaders", ")", "{", "if", "(", "this", ".", "postHeaders", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "headers", "[", "key", "]", "=", "this", ".", "postHeaders", "[", "key", "]", ";", "}", "}", "}", "// Then the headers from the request object", "for", "(", "var", "key", "in", "req", ".", "headers", ")", "{", "if", "(", "req", ".", "headers", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "headers", "[", "key", "]", "=", "req", ".", "headers", "[", "key", "]", ";", "}", "}", "req", ".", "headers", "=", "headers", ";", "}" ]
Normalize the Request object adding default values and additional parameters like a unique ID @param {aria.core.CfgBeans:IOAsyncRequestCfg} req Request object as the input parameter of asyncRequest @private
[ "Normalize", "the", "Request", "object", "adding", "default", "values", "and", "additional", "parameters", "like", "a", "unique", "ID" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IO.js#L405-L455
27,331
ariatemplates/ariatemplates
src/aria/core/IO.js
function (error, request, response) { if (!response) { response = {}; } if (!request && error) { request = this.pendingRequests[error.reqId]; } this.clearTimeout(request.id); this._normalizeResponse(error, request, response); // Extra info for the request object request.res = response; request.endDownload = (new Date()).getTime(); request.downloadTime = request.endDownload - request.beginDownload; request.responseSize = response.responseText.length; this.trafficDown += request.responseSize; this.$raiseEvent({ name : "response", req : request }); delete this.pendingRequests[request.id]; if (aria.core.IOFiltersMgr) { aria.core.IOFiltersMgr.callFiltersOnResponse(request, { fn : this._afterResponseFilters, scope : this, args : request }); } else { this._afterResponseFilters(null, request); } }
javascript
function (error, request, response) { if (!response) { response = {}; } if (!request && error) { request = this.pendingRequests[error.reqId]; } this.clearTimeout(request.id); this._normalizeResponse(error, request, response); // Extra info for the request object request.res = response; request.endDownload = (new Date()).getTime(); request.downloadTime = request.endDownload - request.beginDownload; request.responseSize = response.responseText.length; this.trafficDown += request.responseSize; this.$raiseEvent({ name : "response", req : request }); delete this.pendingRequests[request.id]; if (aria.core.IOFiltersMgr) { aria.core.IOFiltersMgr.callFiltersOnResponse(request, { fn : this._afterResponseFilters, scope : this, args : request }); } else { this._afterResponseFilters(null, request); } }
[ "function", "(", "error", ",", "request", ",", "response", ")", "{", "if", "(", "!", "response", ")", "{", "response", "=", "{", "}", ";", "}", "if", "(", "!", "request", "&&", "error", ")", "{", "request", "=", "this", ".", "pendingRequests", "[", "error", ".", "reqId", "]", ";", "}", "this", ".", "clearTimeout", "(", "request", ".", "id", ")", ";", "this", ".", "_normalizeResponse", "(", "error", ",", "request", ",", "response", ")", ";", "// Extra info for the request object", "request", ".", "res", "=", "response", ";", "request", ".", "endDownload", "=", "(", "new", "Date", "(", ")", ")", ".", "getTime", "(", ")", ";", "request", ".", "downloadTime", "=", "request", ".", "endDownload", "-", "request", ".", "beginDownload", ";", "request", ".", "responseSize", "=", "response", ".", "responseText", ".", "length", ";", "this", ".", "trafficDown", "+=", "request", ".", "responseSize", ";", "this", ".", "$raiseEvent", "(", "{", "name", ":", "\"response\"", ",", "req", ":", "request", "}", ")", ";", "delete", "this", ".", "pendingRequests", "[", "request", ".", "id", "]", ";", "if", "(", "aria", ".", "core", ".", "IOFiltersMgr", ")", "{", "aria", ".", "core", ".", "IOFiltersMgr", ".", "callFiltersOnResponse", "(", "request", ",", "{", "fn", ":", "this", ".", "_afterResponseFilters", ",", "scope", ":", "this", ",", "args", ":", "request", "}", ")", ";", "}", "else", "{", "this", ".", "_afterResponseFilters", "(", "null", ",", "request", ")", ";", "}", "}" ]
Handle a transport response. This is the callback function passed to a transport request @param {Boolean|Object} error Whether there was an error or not @param {aria.core.CfgBeans:IOAsyncRequestCfg} request @param {aria.core.CfgBeans:IOAsyncRequestResponseCfg} response
[ "Handle", "a", "transport", "response", ".", "This", "is", "the", "callback", "function", "passed", "to", "a", "transport", "request" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IO.js#L569-L605
27,332
ariatemplates/ariatemplates
src/aria/core/IO.js
function (unused, req) { var res = req.res, cb = req.callback; if (!cb) { this.$logError(this.MISSING_IO_CALLBACK, [res.url]); } else if (res.error != null) { // an error occured // call the error callback if (cb.onerror == null) { // Generic IO error mgt this.$logError(this.IO_REQUEST_FAILED, [res.url, res.error]); } else { var scope = cb.onerrorScope; if (!scope) { scope = cb.scope; } try { cb.onerror.call(scope, res, cb.args); } catch (ex) { this.$logError(this.IO_CALLBACK_ERROR, [res.url], ex); } } } else { // check the response type to adapt it to the request if (req.expectedResponseType) { this._jsonTextConverter(res, req.expectedResponseType); } cb.fn.call(cb.scope, res, cb.args); } req = cb = null; }
javascript
function (unused, req) { var res = req.res, cb = req.callback; if (!cb) { this.$logError(this.MISSING_IO_CALLBACK, [res.url]); } else if (res.error != null) { // an error occured // call the error callback if (cb.onerror == null) { // Generic IO error mgt this.$logError(this.IO_REQUEST_FAILED, [res.url, res.error]); } else { var scope = cb.onerrorScope; if (!scope) { scope = cb.scope; } try { cb.onerror.call(scope, res, cb.args); } catch (ex) { this.$logError(this.IO_CALLBACK_ERROR, [res.url], ex); } } } else { // check the response type to adapt it to the request if (req.expectedResponseType) { this._jsonTextConverter(res, req.expectedResponseType); } cb.fn.call(cb.scope, res, cb.args); } req = cb = null; }
[ "function", "(", "unused", ",", "req", ")", "{", "var", "res", "=", "req", ".", "res", ",", "cb", "=", "req", ".", "callback", ";", "if", "(", "!", "cb", ")", "{", "this", ".", "$logError", "(", "this", ".", "MISSING_IO_CALLBACK", ",", "[", "res", ".", "url", "]", ")", ";", "}", "else", "if", "(", "res", ".", "error", "!=", "null", ")", "{", "// an error occured", "// call the error callback", "if", "(", "cb", ".", "onerror", "==", "null", ")", "{", "// Generic IO error mgt", "this", ".", "$logError", "(", "this", ".", "IO_REQUEST_FAILED", ",", "[", "res", ".", "url", ",", "res", ".", "error", "]", ")", ";", "}", "else", "{", "var", "scope", "=", "cb", ".", "onerrorScope", ";", "if", "(", "!", "scope", ")", "{", "scope", "=", "cb", ".", "scope", ";", "}", "try", "{", "cb", ".", "onerror", ".", "call", "(", "scope", ",", "res", ",", "cb", ".", "args", ")", ";", "}", "catch", "(", "ex", ")", "{", "this", ".", "$logError", "(", "this", ".", "IO_CALLBACK_ERROR", ",", "[", "res", ".", "url", "]", ",", "ex", ")", ";", "}", "}", "}", "else", "{", "// check the response type to adapt it to the request", "if", "(", "req", ".", "expectedResponseType", ")", "{", "this", ".", "_jsonTextConverter", "(", "res", ",", "req", ".", "expectedResponseType", ")", ";", "}", "cb", ".", "fn", ".", "call", "(", "cb", ".", "scope", ",", "res", ",", "cb", ".", "args", ")", ";", "}", "req", "=", "cb", "=", "null", ";", "}" ]
Continue to process a response, after response filters have been called. @param {Object} unused Unused parameter @param {aria.core.CfgBeans:IOAsyncRequestCfg} req request (may have been modified by filters) @private
[ "Continue", "to", "process", "a", "response", "after", "response", "filters", "have", "been", "called", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IO.js#L656-L688
27,333
ariatemplates/ariatemplates
src/aria/core/IO.js
function (id, timeout, callback) { if (timeout > 0) { this._timeOut[id] = setTimeout(function () { // You won't believe this, but sometimes IE forgets to remove the timeout even if // we explicitely called a clearTimeout. Double check that the timeout is valid if ((module.exports)._timeOut[id]) { (module.exports).abort({ redId : id, getStatus : callback }, null, true); } }, timeout); } }
javascript
function (id, timeout, callback) { if (timeout > 0) { this._timeOut[id] = setTimeout(function () { // You won't believe this, but sometimes IE forgets to remove the timeout even if // we explicitely called a clearTimeout. Double check that the timeout is valid if ((module.exports)._timeOut[id]) { (module.exports).abort({ redId : id, getStatus : callback }, null, true); } }, timeout); } }
[ "function", "(", "id", ",", "timeout", ",", "callback", ")", "{", "if", "(", "timeout", ">", "0", ")", "{", "this", ".", "_timeOut", "[", "id", "]", "=", "setTimeout", "(", "function", "(", ")", "{", "// You won't believe this, but sometimes IE forgets to remove the timeout even if", "// we explicitely called a clearTimeout. Double check that the timeout is valid", "if", "(", "(", "module", ".", "exports", ")", ".", "_timeOut", "[", "id", "]", ")", "{", "(", "module", ".", "exports", ")", ".", "abort", "(", "{", "redId", ":", "id", ",", "getStatus", ":", "callback", "}", ",", "null", ",", "true", ")", ";", "}", "}", ",", "timeout", ")", ";", "}", "}" ]
Set a timeout for a given request. If not canceled this method calls the abort function and the callback after 'timeout' milliseconds @param {Number} id Request id @param {Number} timeout Timer in milliseconds @param {aria.core.CfgBeans:Callback} callback Should be already normalized
[ "Set", "a", "timeout", "for", "a", "given", "request", ".", "If", "not", "canceled", "this", "method", "calls", "the", "abort", "function", "and", "the", "callback", "after", "timeout", "milliseconds" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IO.js#L752-L765
27,334
ariatemplates/ariatemplates
src/aria/core/IO.js
function (xhrObject, callback, isTimeout) { if (!xhrObject) { return false; } var transaction = xhrObject.redId || xhrObject; var request = this.pendingRequests[transaction]; this.clearTimeout(transaction); var abortStatus = false; if (xhrObject.getStatus) { var statusCallback = xhrObject.getStatus; abortStatus = statusCallback.fn.apply(statusCallback.scope, statusCallback.args); } if (request) { abortStatus = true; if (xhrObject === transaction) { xhrObject = { transaction : transaction }; } else { xhrObject.transaction = transaction; } } if (abortStatus === true) { // Fire global custom event -- abortEvent this.$raiseEvent({ name : "abortEvent", o : xhrObject, req : request }); var response = { transaction : request.id, req : request, status : isTimeout ? this.COMM_CODE : this.ABORT_CODE, statusText : isTimeout ? this.TIMEOUT_ERROR : this.ABORT_ERROR }; this._handleResponse(true, request, response); } return abortStatus; }
javascript
function (xhrObject, callback, isTimeout) { if (!xhrObject) { return false; } var transaction = xhrObject.redId || xhrObject; var request = this.pendingRequests[transaction]; this.clearTimeout(transaction); var abortStatus = false; if (xhrObject.getStatus) { var statusCallback = xhrObject.getStatus; abortStatus = statusCallback.fn.apply(statusCallback.scope, statusCallback.args); } if (request) { abortStatus = true; if (xhrObject === transaction) { xhrObject = { transaction : transaction }; } else { xhrObject.transaction = transaction; } } if (abortStatus === true) { // Fire global custom event -- abortEvent this.$raiseEvent({ name : "abortEvent", o : xhrObject, req : request }); var response = { transaction : request.id, req : request, status : isTimeout ? this.COMM_CODE : this.ABORT_CODE, statusText : isTimeout ? this.TIMEOUT_ERROR : this.ABORT_ERROR }; this._handleResponse(true, request, response); } return abortStatus; }
[ "function", "(", "xhrObject", ",", "callback", ",", "isTimeout", ")", "{", "if", "(", "!", "xhrObject", ")", "{", "return", "false", ";", "}", "var", "transaction", "=", "xhrObject", ".", "redId", "||", "xhrObject", ";", "var", "request", "=", "this", ".", "pendingRequests", "[", "transaction", "]", ";", "this", ".", "clearTimeout", "(", "transaction", ")", ";", "var", "abortStatus", "=", "false", ";", "if", "(", "xhrObject", ".", "getStatus", ")", "{", "var", "statusCallback", "=", "xhrObject", ".", "getStatus", ";", "abortStatus", "=", "statusCallback", ".", "fn", ".", "apply", "(", "statusCallback", ".", "scope", ",", "statusCallback", ".", "args", ")", ";", "}", "if", "(", "request", ")", "{", "abortStatus", "=", "true", ";", "if", "(", "xhrObject", "===", "transaction", ")", "{", "xhrObject", "=", "{", "transaction", ":", "transaction", "}", ";", "}", "else", "{", "xhrObject", ".", "transaction", "=", "transaction", ";", "}", "}", "if", "(", "abortStatus", "===", "true", ")", "{", "// Fire global custom event -- abortEvent", "this", ".", "$raiseEvent", "(", "{", "name", ":", "\"abortEvent\"", ",", "o", ":", "xhrObject", ",", "req", ":", "request", "}", ")", ";", "var", "response", "=", "{", "transaction", ":", "request", ".", "id", ",", "req", ":", "request", ",", "status", ":", "isTimeout", "?", "this", ".", "COMM_CODE", ":", "this", ".", "ABORT_CODE", ",", "statusText", ":", "isTimeout", "?", "this", ".", "TIMEOUT_ERROR", ":", "this", ".", "ABORT_ERROR", "}", ";", "this", ".", "_handleResponse", "(", "true", ",", "request", ",", "response", ")", ";", "}", "return", "abortStatus", ";", "}" ]
Method to terminate a transaction, if it has not reached readyState 4. @param {Object|String} xhrObject The connection object returned by asyncRequest or the Request identifier. @param {Object} callback User-defined callback object. @param {String} isTimeout boolean to indicate if abort resulted from a callback timeout. @return {Boolean}
[ "Method", "to", "terminate", "a", "transaction", "if", "it", "has", "not", "reached", "readyState", "4", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IO.js#L783-L830
27,335
ariatemplates/ariatemplates
src/aria/core/IO.js
function (response, expectedResponseType) { if (expectedResponseType == "text") { if (!response.responseText && response.responseJSON != null) { // convert JSON to text if (ariaUtilsType.isString(response.responseJSON)) { // this case is important for JSON-P services which return a simple string // we simply use that string as text // (could be useful to load templates through JSON-P, for example) response.responseText = response.responseJSON; } else { // really convert the JSON structure to a string response.responseText = ariaUtilsJson.convertToJsonString(response.responseJSON); } } } else if (expectedResponseType == "json") { if (response.responseJSON == null && response.responseText != null) { // convert text to JSON var errorMsg = (require("../utils/String")).substitute(this.JSON_PARSING_ERROR, [response.url, response.responseText]); if (response.responseText === "") { var undef; response.responseJSON = undef; } else { response.responseJSON = ariaUtilsJson.load(response.responseText, this, errorMsg); } } } }
javascript
function (response, expectedResponseType) { if (expectedResponseType == "text") { if (!response.responseText && response.responseJSON != null) { // convert JSON to text if (ariaUtilsType.isString(response.responseJSON)) { // this case is important for JSON-P services which return a simple string // we simply use that string as text // (could be useful to load templates through JSON-P, for example) response.responseText = response.responseJSON; } else { // really convert the JSON structure to a string response.responseText = ariaUtilsJson.convertToJsonString(response.responseJSON); } } } else if (expectedResponseType == "json") { if (response.responseJSON == null && response.responseText != null) { // convert text to JSON var errorMsg = (require("../utils/String")).substitute(this.JSON_PARSING_ERROR, [response.url, response.responseText]); if (response.responseText === "") { var undef; response.responseJSON = undef; } else { response.responseJSON = ariaUtilsJson.load(response.responseText, this, errorMsg); } } } }
[ "function", "(", "response", ",", "expectedResponseType", ")", "{", "if", "(", "expectedResponseType", "==", "\"text\"", ")", "{", "if", "(", "!", "response", ".", "responseText", "&&", "response", ".", "responseJSON", "!=", "null", ")", "{", "// convert JSON to text", "if", "(", "ariaUtilsType", ".", "isString", "(", "response", ".", "responseJSON", ")", ")", "{", "// this case is important for JSON-P services which return a simple string", "// we simply use that string as text", "// (could be useful to load templates through JSON-P, for example)", "response", ".", "responseText", "=", "response", ".", "responseJSON", ";", "}", "else", "{", "// really convert the JSON structure to a string", "response", ".", "responseText", "=", "ariaUtilsJson", ".", "convertToJsonString", "(", "response", ".", "responseJSON", ")", ";", "}", "}", "}", "else", "if", "(", "expectedResponseType", "==", "\"json\"", ")", "{", "if", "(", "response", ".", "responseJSON", "==", "null", "&&", "response", ".", "responseText", "!=", "null", ")", "{", "// convert text to JSON", "var", "errorMsg", "=", "(", "require", "(", "\"../utils/String\"", ")", ")", ".", "substitute", "(", "this", ".", "JSON_PARSING_ERROR", ",", "[", "response", ".", "url", ",", "response", ".", "responseText", "]", ")", ";", "if", "(", "response", ".", "responseText", "===", "\"\"", ")", "{", "var", "undef", ";", "response", ".", "responseJSON", "=", "undef", ";", "}", "else", "{", "response", ".", "responseJSON", "=", "ariaUtilsJson", ".", "load", "(", "response", ".", "responseText", ",", "this", ",", "errorMsg", ")", ";", "}", "}", "}", "}" ]
Convert the response text into Json or response Json into text @param {aria.core.CfgBeans:IOAsyncRequestResponseCfg} response Response object @param {String} expectedResponseType The expected response type @protected
[ "Convert", "the", "response", "text", "into", "Json", "or", "response", "Json", "into", "text" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/core/IO.js#L883-L911
27,336
ariatemplates/ariatemplates
src/aria/utils/Event.js
function (e) { // call unload listeners // Keep a local copy of the reference to unloadListeners because it is possible that a listener calls // aria.utils.Event.reset (that's what AriaWindow is doing). var list = unloadListeners.slice(); for (var i = 0, len = list.length; i < len; ++i) { var l = list[i]; if (l) { l[CB].call(this.getEvent(e)); list[i] = null; l = null; } } list = null; }
javascript
function (e) { // call unload listeners // Keep a local copy of the reference to unloadListeners because it is possible that a listener calls // aria.utils.Event.reset (that's what AriaWindow is doing). var list = unloadListeners.slice(); for (var i = 0, len = list.length; i < len; ++i) { var l = list[i]; if (l) { l[CB].call(this.getEvent(e)); list[i] = null; l = null; } } list = null; }
[ "function", "(", "e", ")", "{", "// call unload listeners", "// Keep a local copy of the reference to unloadListeners because it is possible that a listener calls", "// aria.utils.Event.reset (that's what AriaWindow is doing).", "var", "list", "=", "unloadListeners", ".", "slice", "(", ")", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "list", ".", "length", ";", "i", "<", "len", ";", "++", "i", ")", "{", "var", "l", "=", "list", "[", "i", "]", ";", "if", "(", "l", ")", "{", "l", "[", "CB", "]", ".", "call", "(", "this", ".", "getEvent", "(", "e", ")", ")", ";", "list", "[", "i", "]", "=", "null", ";", "l", "=", "null", ";", "}", "}", "list", "=", "null", ";", "}" ]
Handler for the unload event. @param {Object} e DOM event
[ "Handler", "for", "the", "unload", "event", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Event.js#L88-L102
27,337
ariatemplates/ariatemplates
src/aria/utils/Event.js
function (element, event, callback, useCapture, filterFunction) { var added = false; var parent = element.parentElement || element.parentNode; // Fx < 9 compat while (parent != null) { if (!filterFunction || filterFunction(parent)) { added = this.addListener(parent, event, callback, useCapture) || added; } parent = parent.parentElement || parent.parentNode; // Fx < 9 compat } return added; }
javascript
function (element, event, callback, useCapture, filterFunction) { var added = false; var parent = element.parentElement || element.parentNode; // Fx < 9 compat while (parent != null) { if (!filterFunction || filterFunction(parent)) { added = this.addListener(parent, event, callback, useCapture) || added; } parent = parent.parentElement || parent.parentNode; // Fx < 9 compat } return added; }
[ "function", "(", "element", ",", "event", ",", "callback", ",", "useCapture", ",", "filterFunction", ")", "{", "var", "added", "=", "false", ";", "var", "parent", "=", "element", ".", "parentElement", "||", "element", ".", "parentNode", ";", "// Fx < 9 compat", "while", "(", "parent", "!=", "null", ")", "{", "if", "(", "!", "filterFunction", "||", "filterFunction", "(", "parent", ")", ")", "{", "added", "=", "this", ".", "addListener", "(", "parent", ",", "event", ",", "callback", ",", "useCapture", ")", "||", "added", ";", "}", "parent", "=", "parent", ".", "parentElement", "||", "parent", ".", "parentNode", ";", "// Fx < 9 compat", "}", "return", "added", ";", "}" ]
Appends an event handler to the given element and its ancestors. Note that in general you should prefer to use event delegation pattern for performance reasons. Use this method only for events that do not bubble. @param {HTMLElement} element an element reference to assign the listener to. @param {String} event The type of event to append @param {aria.utils.Callback|Object} callback The method the event invokes, if callback is of type Object fn property is mandatory. <strong>Note that callback parameter cannot be a function - the form { fn : {Function}, scope: {Object}, args : {MultiTypes}} is preferred for this callback</strong> @param {Boolean} useCapture capture or bubble phase @param {Function} filterFunction function used to select HTML elements to append the listener to (it selects all the elements if the function is not provided) @return {Boolean} True if at least one listener was added, false otherwise.
[ "Appends", "an", "event", "handler", "to", "the", "given", "element", "and", "its", "ancestors", ".", "Note", "that", "in", "general", "you", "should", "prefer", "to", "use", "event", "delegation", "pattern", "for", "performance", "reasons", ".", "Use", "this", "method", "only", "for", "events", "that", "do", "not", "bubble", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Event.js#L118-L128
27,338
ariatemplates/ariatemplates
src/aria/utils/Event.js
function (element, event, callback, filterFunction) { var removed = false; var parent = element.parentElement || element.parentNode; // Fx < 9 compat while (parent != null) { if (!filterFunction || filterFunction(parent)) { removed = this.removeListener(parent, event, callback) || removed; } parent = parent.parentElement || parent.parentNode; // Fx < 9 compat } return removed; }
javascript
function (element, event, callback, filterFunction) { var removed = false; var parent = element.parentElement || element.parentNode; // Fx < 9 compat while (parent != null) { if (!filterFunction || filterFunction(parent)) { removed = this.removeListener(parent, event, callback) || removed; } parent = parent.parentElement || parent.parentNode; // Fx < 9 compat } return removed; }
[ "function", "(", "element", ",", "event", ",", "callback", ",", "filterFunction", ")", "{", "var", "removed", "=", "false", ";", "var", "parent", "=", "element", ".", "parentElement", "||", "element", ".", "parentNode", ";", "// Fx < 9 compat", "while", "(", "parent", "!=", "null", ")", "{", "if", "(", "!", "filterFunction", "||", "filterFunction", "(", "parent", ")", ")", "{", "removed", "=", "this", ".", "removeListener", "(", "parent", ",", "event", ",", "callback", ")", "||", "removed", ";", "}", "parent", "=", "parent", ".", "parentElement", "||", "parent", ".", "parentNode", ";", "// Fx < 9 compat", "}", "return", "removed", ";", "}" ]
Removes an event handler to every ancestor of the given element. Note that in general you should prefer to use event delegation pattern for performance reasons. Use this method only for events that do not bubble. @param {HTMLElement} element an element reference to remove the listener from. @param {String} event The type of event to remove @param {aria.utils.Callback|Object} callback The method the event invokes, if callback is undefined, then all event handlers for the type of event are removed. @param {Function} filterFunction function used to select HTML elements to remove the listener from (it selects all the elements if the function is not provided) @return {Boolean} True if at least one listener was removed, false otherwise.
[ "Removes", "an", "event", "handler", "to", "every", "ancestor", "of", "the", "given", "element", ".", "Note", "that", "in", "general", "you", "should", "prefer", "to", "use", "event", "delegation", "pattern", "for", "performance", "reasons", ".", "Use", "this", "method", "only", "for", "events", "that", "do", "not", "bubble", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Event.js#L142-L152
27,339
ariatemplates/ariatemplates
src/aria/utils/Event.js
function (element, event) { var normalized = { element: element, event: event }; if ('mousewheel' == event) { if (this.UA.isIE) { if (element == Aria.$window) { normalized.element = element.document; } } else if (!(this.UA.isOpera || this.UA.isSafari || this.UA.isWebkit)) { normalized.event = 'DOMMouseScroll'; } } return normalized; }
javascript
function (element, event) { var normalized = { element: element, event: event }; if ('mousewheel' == event) { if (this.UA.isIE) { if (element == Aria.$window) { normalized.element = element.document; } } else if (!(this.UA.isOpera || this.UA.isSafari || this.UA.isWebkit)) { normalized.event = 'DOMMouseScroll'; } } return normalized; }
[ "function", "(", "element", ",", "event", ")", "{", "var", "normalized", "=", "{", "element", ":", "element", ",", "event", ":", "event", "}", ";", "if", "(", "'mousewheel'", "==", "event", ")", "{", "if", "(", "this", ".", "UA", ".", "isIE", ")", "{", "if", "(", "element", "==", "Aria", ".", "$window", ")", "{", "normalized", ".", "element", "=", "element", ".", "document", ";", "}", "}", "else", "if", "(", "!", "(", "this", ".", "UA", ".", "isOpera", "||", "this", ".", "UA", ".", "isSafari", "||", "this", ".", "UA", ".", "isWebkit", ")", ")", "{", "normalized", ".", "event", "=", "'DOMMouseScroll'", ";", "}", "}", "return", "normalized", ";", "}" ]
Normalize target and event for cross-browser compatibility @param {EventTarget} target of the event @param {String} event type @protected
[ "Normalize", "target", "and", "event", "for", "cross", "-", "browser", "compatibility" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/Event.js#L429-L444
27,340
ariatemplates/ariatemplates
src/aria/templates/TplParser.js
function (template, context, statements, throwErrors) { this.context = context; this._prepare(template, throwErrors); this._computeLineNumbers(); return this._buildTree(throwErrors); }
javascript
function (template, context, statements, throwErrors) { this.context = context; this._prepare(template, throwErrors); this._computeLineNumbers(); return this._buildTree(throwErrors); }
[ "function", "(", "template", ",", "context", ",", "statements", ",", "throwErrors", ")", "{", "this", ".", "context", "=", "context", ";", "this", ".", "_prepare", "(", "template", ",", "throwErrors", ")", ";", "this", ".", "_computeLineNumbers", "(", ")", ";", "return", "this", ".", "_buildTree", "(", "throwErrors", ")", ";", "}" ]
Parse the given template and return a tree representing the template. @param {String} template template to parse @param {object} context template context data, passes additional information the to error log) @param {Object} statements list of statements allowed by the class generator @param {Boolean} throwErrors if true, errors will be thrown instead of being logged @return {aria.templates.TreeBeans:Root} The tree built from the template, or null if an error occured. After the execution of this method, this.template contains the template with comments and some spaces and removed, and this.positionToLineNumber can be used to transform positions in this.template into line numbers.
[ "Parse", "the", "given", "template", "and", "return", "a", "tree", "representing", "the", "template", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/TplParser.js#L37-L42
27,341
ariatemplates/ariatemplates
src/aria/widgets/action/SortIndicator.js
function () { var cfg = this._cfg; var anchorElement = ariaUtilsDom.getDomElementChild(this.getDom(), 0); var ellipseElement = Aria.$window.document.createElement("span"); ellipseElement.innerHTML = ariaUtilsString.escapeHTML(cfg.label); this.textContent = cfg.label; if (ellipseElement.innerHTML) { anchorElement.insertBefore(ellipseElement, anchorElement.firstChild); } var labelWidth = cfg.labelWidth; if (labelWidth > 0) { this._ellipsis = new ariaUtilsEllipsis(ellipseElement, labelWidth, cfg.ellipsisLocation, cfg.ellipsis, this._context, cfg.ellipsisEndStyle); } if (ellipseElement.innerHTML) { anchorElement.removeChild(anchorElement.childNodes[1]); } }
javascript
function () { var cfg = this._cfg; var anchorElement = ariaUtilsDom.getDomElementChild(this.getDom(), 0); var ellipseElement = Aria.$window.document.createElement("span"); ellipseElement.innerHTML = ariaUtilsString.escapeHTML(cfg.label); this.textContent = cfg.label; if (ellipseElement.innerHTML) { anchorElement.insertBefore(ellipseElement, anchorElement.firstChild); } var labelWidth = cfg.labelWidth; if (labelWidth > 0) { this._ellipsis = new ariaUtilsEllipsis(ellipseElement, labelWidth, cfg.ellipsisLocation, cfg.ellipsis, this._context, cfg.ellipsisEndStyle); } if (ellipseElement.innerHTML) { anchorElement.removeChild(anchorElement.childNodes[1]); } }
[ "function", "(", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "var", "anchorElement", "=", "ariaUtilsDom", ".", "getDomElementChild", "(", "this", ".", "getDom", "(", ")", ",", "0", ")", ";", "var", "ellipseElement", "=", "Aria", ".", "$window", ".", "document", ".", "createElement", "(", "\"span\"", ")", ";", "ellipseElement", ".", "innerHTML", "=", "ariaUtilsString", ".", "escapeHTML", "(", "cfg", ".", "label", ")", ";", "this", ".", "textContent", "=", "cfg", ".", "label", ";", "if", "(", "ellipseElement", ".", "innerHTML", ")", "{", "anchorElement", ".", "insertBefore", "(", "ellipseElement", ",", "anchorElement", ".", "firstChild", ")", ";", "}", "var", "labelWidth", "=", "cfg", ".", "labelWidth", ";", "if", "(", "labelWidth", ">", "0", ")", "{", "this", ".", "_ellipsis", "=", "new", "ariaUtilsEllipsis", "(", "ellipseElement", ",", "labelWidth", ",", "cfg", ".", "ellipsisLocation", ",", "cfg", ".", "ellipsis", ",", "this", ".", "_context", ",", "cfg", ".", "ellipsisEndStyle", ")", ";", "}", "if", "(", "ellipseElement", ".", "innerHTML", ")", "{", "anchorElement", ".", "removeChild", "(", "anchorElement", ".", "childNodes", "[", "1", "]", ")", ";", "}", "}" ]
Called when a new instance is created if an ellipsis is needed on this SortIndicator instance @protected
[ "Called", "when", "a", "new", "instance", "is", "created", "if", "an", "ellipsis", "is", "needed", "on", "this", "SortIndicator", "instance" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/SortIndicator.js#L183-L205
27,342
ariatemplates/ariatemplates
src/aria/widgets/action/SortIndicator.js
function (out) { var cfg = this._cfg; var tabString = (cfg.tabIndex != null ? ' tabindex="' + this._calculateTabIndex() + '" ' : ' '); out.write(['<a', Aria.testMode ? ' id="' + this._domId + '_link"' : '', ' class="sortIndicatorLink" href="#"' + tabString + this._getWaiAriaMarkup() + '>' + ariaUtilsString.escapeHTML(cfg.label)].join("")); this._icon.writeMarkup(out); out.write('</a>'); }
javascript
function (out) { var cfg = this._cfg; var tabString = (cfg.tabIndex != null ? ' tabindex="' + this._calculateTabIndex() + '" ' : ' '); out.write(['<a', Aria.testMode ? ' id="' + this._domId + '_link"' : '', ' class="sortIndicatorLink" href="#"' + tabString + this._getWaiAriaMarkup() + '>' + ariaUtilsString.escapeHTML(cfg.label)].join("")); this._icon.writeMarkup(out); out.write('</a>'); }
[ "function", "(", "out", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "var", "tabString", "=", "(", "cfg", ".", "tabIndex", "!=", "null", "?", "' tabindex=\"'", "+", "this", ".", "_calculateTabIndex", "(", ")", "+", "'\" '", ":", "' '", ")", ";", "out", ".", "write", "(", "[", "'<a'", ",", "Aria", ".", "testMode", "?", "' id=\"'", "+", "this", ".", "_domId", "+", "'_link\"'", ":", "''", ",", "' class=\"sortIndicatorLink\" href=\"#\"'", "+", "tabString", "+", "this", ".", "_getWaiAriaMarkup", "(", ")", "+", "'>'", "+", "ariaUtilsString", ".", "escapeHTML", "(", "cfg", ".", "label", ")", "]", ".", "join", "(", "\"\"", ")", ")", ";", "this", ".", "_icon", ".", "writeMarkup", "(", "out", ")", ";", "out", ".", "write", "(", "'</a>'", ")", ";", "}" ]
Internal function to override to generate the internal widget markup @param {aria.templates.MarkupWriter} out Markup writer @protected
[ "Internal", "function", "to", "override", "to", "generate", "the", "internal", "widget", "markup" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/SortIndicator.js#L220-L227
27,343
ariatemplates/ariatemplates
src/aria/widgets/action/SortIndicator.js
function (cfg) { if (cfg.view.sortName == cfg.sortName) { if (cfg.view.sortOrder == 'A') { return this.ASCENDING_STATE; } else if (cfg.view.sortOrder == 'D') { return this.DESCENDING_STATE; } } else { return this.NORMAL_STATE; } }
javascript
function (cfg) { if (cfg.view.sortName == cfg.sortName) { if (cfg.view.sortOrder == 'A') { return this.ASCENDING_STATE; } else if (cfg.view.sortOrder == 'D') { return this.DESCENDING_STATE; } } else { return this.NORMAL_STATE; } }
[ "function", "(", "cfg", ")", "{", "if", "(", "cfg", ".", "view", ".", "sortName", "==", "cfg", ".", "sortName", ")", "{", "if", "(", "cfg", ".", "view", ".", "sortOrder", "==", "'A'", ")", "{", "return", "this", ".", "ASCENDING_STATE", ";", "}", "else", "if", "(", "cfg", ".", "view", ".", "sortOrder", "==", "'D'", ")", "{", "return", "this", ".", "DESCENDING_STATE", ";", "}", "}", "else", "{", "return", "this", ".", "NORMAL_STATE", ";", "}", "}" ]
Internal method to set the initial _state property from the _cfg description based on the config properties @protected @param {Object} cfg Config properties @return {String} new state
[ "Internal", "method", "to", "set", "the", "initial", "_state", "property", "from", "the", "_cfg", "description", "based", "on", "the", "config", "properties" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/SortIndicator.js#L235-L245
27,344
ariatemplates/ariatemplates
src/aria/widgets/action/SortIndicator.js
function () { var cfg = this._cfg, sortKeyGetter = cfg.sortKeyGetter; if (sortKeyGetter) { var view = cfg.view; view.toggleSortOrder(cfg.sortName, sortKeyGetter); view.refresh(); } }
javascript
function () { var cfg = this._cfg, sortKeyGetter = cfg.sortKeyGetter; if (sortKeyGetter) { var view = cfg.view; view.toggleSortOrder(cfg.sortName, sortKeyGetter); view.refresh(); } }
[ "function", "(", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ",", "sortKeyGetter", "=", "cfg", ".", "sortKeyGetter", ";", "if", "(", "sortKeyGetter", ")", "{", "var", "view", "=", "cfg", ".", "view", ";", "view", ".", "toggleSortOrder", "(", "cfg", ".", "sortName", ",", "sortKeyGetter", ")", ";", "view", ".", "refresh", "(", ")", ";", "}", "}" ]
Internal method to sort the list @protected
[ "Internal", "method", "to", "sort", "the", "list" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/SortIndicator.js#L251-L258
27,345
ariatemplates/ariatemplates
src/aria/widgets/action/SortIndicator.js
function (domEvt) { if (this._actingDom && this._hasMouseOver === false) { this._hasFocus = true; var offset; if (ariaCoreBrowser.isFirefox) { offset = { left : 1, top : 2 }; } else { offset = { left : 1, top : 1 }; } if (this._ellipsis) { this._ellipsis.displayFullText(offset); } } }
javascript
function (domEvt) { if (this._actingDom && this._hasMouseOver === false) { this._hasFocus = true; var offset; if (ariaCoreBrowser.isFirefox) { offset = { left : 1, top : 2 }; } else { offset = { left : 1, top : 1 }; } if (this._ellipsis) { this._ellipsis.displayFullText(offset); } } }
[ "function", "(", "domEvt", ")", "{", "if", "(", "this", ".", "_actingDom", "&&", "this", ".", "_hasMouseOver", "===", "false", ")", "{", "this", ".", "_hasFocus", "=", "true", ";", "var", "offset", ";", "if", "(", "ariaCoreBrowser", ".", "isFirefox", ")", "{", "offset", "=", "{", "left", ":", "1", ",", "top", ":", "2", "}", ";", "}", "else", "{", "offset", "=", "{", "left", ":", "1", ",", "top", ":", "1", "}", ";", "}", "if", "(", "this", ".", "_ellipsis", ")", "{", "this", ".", "_ellipsis", ".", "displayFullText", "(", "offset", ")", ";", "}", "}", "}" ]
The method called when the widget gets focus @param {aria.DomEvent} domEvt Focus event @protected
[ "The", "method", "called", "when", "the", "widget", "gets", "focus" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/SortIndicator.js#L385-L404
27,346
ariatemplates/ariatemplates
src/aria/widgets/action/SortIndicator.js
function (domEvt) { if (this._hasMouseOver === false && this._hasFocus === true) { this._hasFocus = false; if (this._ellipsis) { this._ellipsis._hideFullText(domEvt.relatedTarget); } } }
javascript
function (domEvt) { if (this._hasMouseOver === false && this._hasFocus === true) { this._hasFocus = false; if (this._ellipsis) { this._ellipsis._hideFullText(domEvt.relatedTarget); } } }
[ "function", "(", "domEvt", ")", "{", "if", "(", "this", ".", "_hasMouseOver", "===", "false", "&&", "this", ".", "_hasFocus", "===", "true", ")", "{", "this", ".", "_hasFocus", "=", "false", ";", "if", "(", "this", ".", "_ellipsis", ")", "{", "this", ".", "_ellipsis", ".", "_hideFullText", "(", "domEvt", ".", "relatedTarget", ")", ";", "}", "}", "}" ]
The method called when focus leaves the widget @param {aria.DomEvent} domEvt Blur event @protected
[ "The", "method", "called", "when", "focus", "leaves", "the", "widget" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/SortIndicator.js#L411-L418
27,347
ariatemplates/ariatemplates
src/aria/widgets/action/SortIndicator.js
function (domEvt) { this._sortList(); // handle an onclick event this.$ActionWidget._dom_onclick.apply(this, arguments); if (this._cfg) { this._updateDisplay(); if (this._cfg.refreshArgs) { this._doPartialRefresh(this._cfg.refreshArgs); } else { this._context.$refresh(); } } domEvt.preventDefault(); return false; }
javascript
function (domEvt) { this._sortList(); // handle an onclick event this.$ActionWidget._dom_onclick.apply(this, arguments); if (this._cfg) { this._updateDisplay(); if (this._cfg.refreshArgs) { this._doPartialRefresh(this._cfg.refreshArgs); } else { this._context.$refresh(); } } domEvt.preventDefault(); return false; }
[ "function", "(", "domEvt", ")", "{", "this", ".", "_sortList", "(", ")", ";", "// handle an onclick event", "this", ".", "$ActionWidget", ".", "_dom_onclick", ".", "apply", "(", "this", ",", "arguments", ")", ";", "if", "(", "this", ".", "_cfg", ")", "{", "this", ".", "_updateDisplay", "(", ")", ";", "if", "(", "this", ".", "_cfg", ".", "refreshArgs", ")", "{", "this", ".", "_doPartialRefresh", "(", "this", ".", "_cfg", ".", "refreshArgs", ")", ";", "}", "else", "{", "this", ".", "_context", ".", "$refresh", "(", ")", ";", "}", "}", "domEvt", ".", "preventDefault", "(", ")", ";", "return", "false", ";", "}" ]
The method called when the markup of the widget is clicked @param {aria.DomEvent} domEvt Click event @protected
[ "The", "method", "called", "when", "the", "markup", "of", "the", "widget", "is", "clicked" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/action/SortIndicator.js#L425-L443
27,348
ariatemplates/ariatemplates
src/aria/templates/Section.js
function () { var differed = []; // it is possible, with the dialog, that we insert an already initialized section inside a non // initialized section if (this._initWidgetsDone) { return differed; } this._initWidgetsDone = true; this.html = null; // html should no longer be used once widgets are initialized var content = this._content; var contentSize = content.length; for (var i = 0; i < contentSize; i++) { var elt = content[i]; // case widget if (elt._type == TYPE_BEHAVIOR) { var bhv = elt.behavior; if (bhv.initWidget) { try { bhv.initWidget(); if (bhv.isDiffered) { differed.push(bhv); } } catch (e) { this.$logError(this.WIDGETCALL_ERROR, [bhv.$classpath, "initWidget"], e); } } } else { // case section differed = differed.concat(elt.initWidgets()); } } // The following line displays the processing indicator on the section (if needed) this.refreshProcessingIndicator(); return differed; }
javascript
function () { var differed = []; // it is possible, with the dialog, that we insert an already initialized section inside a non // initialized section if (this._initWidgetsDone) { return differed; } this._initWidgetsDone = true; this.html = null; // html should no longer be used once widgets are initialized var content = this._content; var contentSize = content.length; for (var i = 0; i < contentSize; i++) { var elt = content[i]; // case widget if (elt._type == TYPE_BEHAVIOR) { var bhv = elt.behavior; if (bhv.initWidget) { try { bhv.initWidget(); if (bhv.isDiffered) { differed.push(bhv); } } catch (e) { this.$logError(this.WIDGETCALL_ERROR, [bhv.$classpath, "initWidget"], e); } } } else { // case section differed = differed.concat(elt.initWidgets()); } } // The following line displays the processing indicator on the section (if needed) this.refreshProcessingIndicator(); return differed; }
[ "function", "(", ")", "{", "var", "differed", "=", "[", "]", ";", "// it is possible, with the dialog, that we insert an already initialized section inside a non", "// initialized section", "if", "(", "this", ".", "_initWidgetsDone", ")", "{", "return", "differed", ";", "}", "this", ".", "_initWidgetsDone", "=", "true", ";", "this", ".", "html", "=", "null", ";", "// html should no longer be used once widgets are initialized", "var", "content", "=", "this", ".", "_content", ";", "var", "contentSize", "=", "content", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "contentSize", ";", "i", "++", ")", "{", "var", "elt", "=", "content", "[", "i", "]", ";", "// case widget", "if", "(", "elt", ".", "_type", "==", "TYPE_BEHAVIOR", ")", "{", "var", "bhv", "=", "elt", ".", "behavior", ";", "if", "(", "bhv", ".", "initWidget", ")", "{", "try", "{", "bhv", ".", "initWidget", "(", ")", ";", "if", "(", "bhv", ".", "isDiffered", ")", "{", "differed", ".", "push", "(", "bhv", ")", ";", "}", "}", "catch", "(", "e", ")", "{", "this", ".", "$logError", "(", "this", ".", "WIDGETCALL_ERROR", ",", "[", "bhv", ".", "$classpath", ",", "\"initWidget\"", "]", ",", "e", ")", ";", "}", "}", "}", "else", "{", "// case section", "differed", "=", "differed", ".", "concat", "(", "elt", ".", "initWidgets", "(", ")", ")", ";", "}", "}", "// The following line displays the processing indicator on the section (if needed)", "this", ".", "refreshProcessingIndicator", "(", ")", ";", "return", "differed", ";", "}" ]
Initialize the widgets contained in the section if not already done @return {Array} List of element that will be rendered later on
[ "Initialize", "the", "widgets", "contained", "in", "the", "section", "if", "not", "already", "done" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L403-L437
27,349
ariatemplates/ariatemplates
src/aria/templates/Section.js
function () { this.$raiseEvent("beforeRemoveContent"); // so that the children section can see that it is useless to remove themselves from // their parent: this._removingContent = true; var content = this._content; var contentLength = content.length; for (var i = 0; i < contentLength; i++) { var elt = content[i]; if (elt._type == TYPE_BEHAVIOR) { var bhv = elt.behavior; if (elt.id && this.idMap) { this.idMap[elt.id] = null; delete this.idMap[elt.id]; } bhv.$dispose(); } else { elt.$dispose(); } } this._content = []; this._initWidgetsDone = false; this._removingContent = false; this.$raiseEvent("afterRemoveContent"); }
javascript
function () { this.$raiseEvent("beforeRemoveContent"); // so that the children section can see that it is useless to remove themselves from // their parent: this._removingContent = true; var content = this._content; var contentLength = content.length; for (var i = 0; i < contentLength; i++) { var elt = content[i]; if (elt._type == TYPE_BEHAVIOR) { var bhv = elt.behavior; if (elt.id && this.idMap) { this.idMap[elt.id] = null; delete this.idMap[elt.id]; } bhv.$dispose(); } else { elt.$dispose(); } } this._content = []; this._initWidgetsDone = false; this._removingContent = false; this.$raiseEvent("afterRemoveContent"); }
[ "function", "(", ")", "{", "this", ".", "$raiseEvent", "(", "\"beforeRemoveContent\"", ")", ";", "// so that the children section can see that it is useless to remove themselves from", "// their parent:", "this", ".", "_removingContent", "=", "true", ";", "var", "content", "=", "this", ".", "_content", ";", "var", "contentLength", "=", "content", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "contentLength", ";", "i", "++", ")", "{", "var", "elt", "=", "content", "[", "i", "]", ";", "if", "(", "elt", ".", "_type", "==", "TYPE_BEHAVIOR", ")", "{", "var", "bhv", "=", "elt", ".", "behavior", ";", "if", "(", "elt", ".", "id", "&&", "this", ".", "idMap", ")", "{", "this", ".", "idMap", "[", "elt", ".", "id", "]", "=", "null", ";", "delete", "this", ".", "idMap", "[", "elt", ".", "id", "]", ";", "}", "bhv", ".", "$dispose", "(", ")", ";", "}", "else", "{", "elt", ".", "$dispose", "(", ")", ";", "}", "}", "this", ".", "_content", "=", "[", "]", ";", "this", ".", "_initWidgetsDone", "=", "false", ";", "this", ".", "_removingContent", "=", "false", ";", "this", ".", "$raiseEvent", "(", "\"afterRemoveContent\"", ")", ";", "}" ]
Remove any content from the section. The dom is not modified by this call.
[ "Remove", "any", "content", "from", "the", "section", ".", "The", "dom", "is", "not", "modified", "by", "this", "call", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L442-L467
27,350
ariatemplates/ariatemplates
src/aria/templates/Section.js
function () { // remove delegation done with "on" statement if (this.delegateIds) { for (var i = 0, l = this.delegateIds.length; i < l; i++) { ariaUtilsDelegate.remove(this.delegateIds[i]); } this.delegateIds = []; } for (var i = 0, l = this.delegateCallbacks.length; i < l; i++) { this.delegateCallbacks[i].$dispose(); } this.delegateCallbacks = []; }
javascript
function () { // remove delegation done with "on" statement if (this.delegateIds) { for (var i = 0, l = this.delegateIds.length; i < l; i++) { ariaUtilsDelegate.remove(this.delegateIds[i]); } this.delegateIds = []; } for (var i = 0, l = this.delegateCallbacks.length; i < l; i++) { this.delegateCallbacks[i].$dispose(); } this.delegateCallbacks = []; }
[ "function", "(", ")", "{", "// remove delegation done with \"on\" statement", "if", "(", "this", ".", "delegateIds", ")", "{", "for", "(", "var", "i", "=", "0", ",", "l", "=", "this", ".", "delegateIds", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "ariaUtilsDelegate", ".", "remove", "(", "this", ".", "delegateIds", "[", "i", "]", ")", ";", "}", "this", ".", "delegateIds", "=", "[", "]", ";", "}", "for", "(", "var", "i", "=", "0", ",", "l", "=", "this", ".", "delegateCallbacks", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "this", ".", "delegateCallbacks", "[", "i", "]", ".", "$dispose", "(", ")", ";", "}", "this", ".", "delegateCallbacks", "=", "[", "]", ";", "}" ]
Remove the delegateIds from the aria.utils.Delegate maps and disposes the delegated callbacks
[ "Remove", "the", "delegateIds", "from", "the", "aria", ".", "utils", ".", "Delegate", "maps", "and", "disposes", "the", "delegated", "callbacks" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L472-L485
27,351
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (bhv) { var bhvId = (bhv.getId ? bhv.getId() : null); var element = { _type : TYPE_BEHAVIOR, behavior : bhv, section : this, id : bhvId }; if (bhvId && this.idMap) { if (this.idMap[bhvId]) { // TODO: change error message as this may be, in the future, other things than a widget // TODO: add context info this.$logError(this.WIDGET_ID_NOT_UNIQUE, [this.tplCtxt.tplClasspath, bhvId, bhv.$class]); element.id = null; } else { this.idMap[bhvId] = element; } } this._content.push(element); }
javascript
function (bhv) { var bhvId = (bhv.getId ? bhv.getId() : null); var element = { _type : TYPE_BEHAVIOR, behavior : bhv, section : this, id : bhvId }; if (bhvId && this.idMap) { if (this.idMap[bhvId]) { // TODO: change error message as this may be, in the future, other things than a widget // TODO: add context info this.$logError(this.WIDGET_ID_NOT_UNIQUE, [this.tplCtxt.tplClasspath, bhvId, bhv.$class]); element.id = null; } else { this.idMap[bhvId] = element; } } this._content.push(element); }
[ "function", "(", "bhv", ")", "{", "var", "bhvId", "=", "(", "bhv", ".", "getId", "?", "bhv", ".", "getId", "(", ")", ":", "null", ")", ";", "var", "element", "=", "{", "_type", ":", "TYPE_BEHAVIOR", ",", "behavior", ":", "bhv", ",", "section", ":", "this", ",", "id", ":", "bhvId", "}", ";", "if", "(", "bhvId", "&&", "this", ".", "idMap", ")", "{", "if", "(", "this", ".", "idMap", "[", "bhvId", "]", ")", "{", "// TODO: change error message as this may be, in the future, other things than a widget", "// TODO: add context info", "this", ".", "$logError", "(", "this", ".", "WIDGET_ID_NOT_UNIQUE", ",", "[", "this", ".", "tplCtxt", ".", "tplClasspath", ",", "bhvId", ",", "bhv", ".", "$class", "]", ")", ";", "element", ".", "id", "=", "null", ";", "}", "else", "{", "this", ".", "idMap", "[", "bhvId", "]", "=", "element", ";", "}", "}", "this", ".", "_content", ".", "push", "(", "element", ")", ";", "}" ]
Register a widget in this section @param {Object} bhv the behaviour to add to this section
[ "Register", "a", "widget", "in", "this", "section" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L490-L511
27,352
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (id) { var res = this.idMap ? this.idMap[id] : null; if (res && res._type == TYPE_BEHAVIOR) { return res.behavior; } return null; }
javascript
function (id) { var res = this.idMap ? this.idMap[id] : null; if (res && res._type == TYPE_BEHAVIOR) { return res.behavior; } return null; }
[ "function", "(", "id", ")", "{", "var", "res", "=", "this", ".", "idMap", "?", "this", ".", "idMap", "[", "id", "]", ":", "null", ";", "if", "(", "res", "&&", "res", ".", "_type", "==", "TYPE_BEHAVIOR", ")", "{", "return", "res", ".", "behavior", ";", "}", "return", "null", ";", "}" ]
Returns a behaviour with given id from this section @param {String} id
[ "Returns", "a", "behaviour", "with", "given", "id", "from", "this", "section" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L517-L523
27,353
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (id) { var res = this.idMap ? this.idMap[id] : null; if (res && res._type == TYPE_SECTION) { return res; } return null; }
javascript
function (id) { var res = this.idMap ? this.idMap[id] : null; if (res && res._type == TYPE_SECTION) { return res; } return null; }
[ "function", "(", "id", ")", "{", "var", "res", "=", "this", ".", "idMap", "?", "this", ".", "idMap", "[", "id", "]", ":", "null", ";", "if", "(", "res", "&&", "res", ".", "_type", "==", "TYPE_SECTION", ")", "{", "return", "res", ";", "}", "return", "null", ";", "}" ]
Returns a section with given id from this section @param {String} id
[ "Returns", "a", "section", "with", "given", "id", "from", "this", "section" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L529-L535
27,354
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (idMap) { if (this.idMap == idMap) { // already the same id map (especially useful if both are null) return; } // set child idMap to its parent value this.idMap = idMap; var id = this.id; if (id && idMap) { if (idMap[id]) { this.$logError(this.SECTION_ALREADY_EXISTS, [this.tplCtxt.tplClasspath, id]); } else { idMap[id] = this; } } var content = this._content; var contentSize = content.length; // add the ids found in this section to the parent map: // and recursively call __updateIdMap for (var i = 0; i < contentSize; i++) { var elt = content[i]; if (elt._type == TYPE_SECTION) { elt.__updateIdMap(idMap); } else { id = elt.id; if (id && idMap) { if (idMap[id]) { this.$logError(this.WIDGET_ID_NOT_UNIQUE, [this.tplCtxt.tplClasspath, id, elt.behavior.$class]); } else { idMap[id] = elt; } } } } }
javascript
function (idMap) { if (this.idMap == idMap) { // already the same id map (especially useful if both are null) return; } // set child idMap to its parent value this.idMap = idMap; var id = this.id; if (id && idMap) { if (idMap[id]) { this.$logError(this.SECTION_ALREADY_EXISTS, [this.tplCtxt.tplClasspath, id]); } else { idMap[id] = this; } } var content = this._content; var contentSize = content.length; // add the ids found in this section to the parent map: // and recursively call __updateIdMap for (var i = 0; i < contentSize; i++) { var elt = content[i]; if (elt._type == TYPE_SECTION) { elt.__updateIdMap(idMap); } else { id = elt.id; if (id && idMap) { if (idMap[id]) { this.$logError(this.WIDGET_ID_NOT_UNIQUE, [this.tplCtxt.tplClasspath, id, elt.behavior.$class]); } else { idMap[id] = elt; } } } } }
[ "function", "(", "idMap", ")", "{", "if", "(", "this", ".", "idMap", "==", "idMap", ")", "{", "// already the same id map (especially useful if both are null)", "return", ";", "}", "// set child idMap to its parent value", "this", ".", "idMap", "=", "idMap", ";", "var", "id", "=", "this", ".", "id", ";", "if", "(", "id", "&&", "idMap", ")", "{", "if", "(", "idMap", "[", "id", "]", ")", "{", "this", ".", "$logError", "(", "this", ".", "SECTION_ALREADY_EXISTS", ",", "[", "this", ".", "tplCtxt", ".", "tplClasspath", ",", "id", "]", ")", ";", "}", "else", "{", "idMap", "[", "id", "]", "=", "this", ";", "}", "}", "var", "content", "=", "this", ".", "_content", ";", "var", "contentSize", "=", "content", ".", "length", ";", "// add the ids found in this section to the parent map:", "// and recursively call __updateIdMap", "for", "(", "var", "i", "=", "0", ";", "i", "<", "contentSize", ";", "i", "++", ")", "{", "var", "elt", "=", "content", "[", "i", "]", ";", "if", "(", "elt", ".", "_type", "==", "TYPE_SECTION", ")", "{", "elt", ".", "__updateIdMap", "(", "idMap", ")", ";", "}", "else", "{", "id", "=", "elt", ".", "id", ";", "if", "(", "id", "&&", "idMap", ")", "{", "if", "(", "idMap", "[", "id", "]", ")", "{", "this", ".", "$logError", "(", "this", ".", "WIDGET_ID_NOT_UNIQUE", ",", "[", "this", ".", "tplCtxt", ".", "tplClasspath", ",", "id", ",", "elt", ".", "behavior", ".", "$class", "]", ")", ";", "}", "else", "{", "idMap", "[", "id", "]", "=", "elt", ";", "}", "}", "}", "}", "}" ]
Used to replace the sub-sections idMap with the one from the parent, and to add to the parent's map the ids from sub-sections @param {Object} idMap @private
[ "Used", "to", "replace", "the", "sub", "-", "sections", "idMap", "with", "the", "one", "from", "the", "parent", "and", "to", "add", "to", "the", "parent", "s", "map", "the", "ids", "from", "sub", "-", "sections" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L558-L593
27,355
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (bind, callback) { var jsonChangeCallback = null; // register as listener for the bindings defined for this control: if (bind) { jsonChangeCallback = { fn : callback || this._notifyDataChange, scope : this, args : { tplCtxt : this.tplCtxt, animate : bind.animate } }; // addListener throws errors try { // normalize recursive bind.recursive = bind.recursive !== false; this.__json.addListener(bind.inside, bind.to, jsonChangeCallback, true, bind.recursive); // save for disposal this._bindings.push({ inside : bind.inside, callback : jsonChangeCallback, to : bind.to, recursive : bind.recursive }); } catch (e) { this.$logError(this.SECTION_BINDING_ERROR, [bind.inside, bind.to, this.id, this.tplCtxt.tplClasspath]); jsonChangeCallback = null; } return jsonChangeCallback; } }
javascript
function (bind, callback) { var jsonChangeCallback = null; // register as listener for the bindings defined for this control: if (bind) { jsonChangeCallback = { fn : callback || this._notifyDataChange, scope : this, args : { tplCtxt : this.tplCtxt, animate : bind.animate } }; // addListener throws errors try { // normalize recursive bind.recursive = bind.recursive !== false; this.__json.addListener(bind.inside, bind.to, jsonChangeCallback, true, bind.recursive); // save for disposal this._bindings.push({ inside : bind.inside, callback : jsonChangeCallback, to : bind.to, recursive : bind.recursive }); } catch (e) { this.$logError(this.SECTION_BINDING_ERROR, [bind.inside, bind.to, this.id, this.tplCtxt.tplClasspath]); jsonChangeCallback = null; } return jsonChangeCallback; } }
[ "function", "(", "bind", ",", "callback", ")", "{", "var", "jsonChangeCallback", "=", "null", ";", "// register as listener for the bindings defined for this control:", "if", "(", "bind", ")", "{", "jsonChangeCallback", "=", "{", "fn", ":", "callback", "||", "this", ".", "_notifyDataChange", ",", "scope", ":", "this", ",", "args", ":", "{", "tplCtxt", ":", "this", ".", "tplCtxt", ",", "animate", ":", "bind", ".", "animate", "}", "}", ";", "// addListener throws errors", "try", "{", "// normalize recursive", "bind", ".", "recursive", "=", "bind", ".", "recursive", "!==", "false", ";", "this", ".", "__json", ".", "addListener", "(", "bind", ".", "inside", ",", "bind", ".", "to", ",", "jsonChangeCallback", ",", "true", ",", "bind", ".", "recursive", ")", ";", "// save for disposal", "this", ".", "_bindings", ".", "push", "(", "{", "inside", ":", "bind", ".", "inside", ",", "callback", ":", "jsonChangeCallback", ",", "to", ":", "bind", ".", "to", ",", "recursive", ":", "bind", ".", "recursive", "}", ")", ";", "}", "catch", "(", "e", ")", "{", "this", ".", "$logError", "(", "this", ".", "SECTION_BINDING_ERROR", ",", "[", "bind", ".", "inside", ",", "bind", ".", "to", ",", "this", ".", "id", ",", "this", ".", "tplCtxt", ".", "tplClasspath", "]", ")", ";", "jsonChangeCallback", "=", "null", ";", "}", "return", "jsonChangeCallback", ";", "}", "}" ]
RegisterBinding is used to add bindings to Templates and sections. @param {aria.templates.CfgBeans:BindingConfiguration} bind @param {Object} callback @return {aria.core.CfgBeans:Callback} Listener that has been actually added
[ "RegisterBinding", "is", "used", "to", "add", "bindings", "to", "Templates", "and", "sections", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L612-L644
27,356
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (visible, options) { visible = !!visible; var alreadyVisible = !!this._overlayId; if (visible !== alreadyVisible) { if (visible) { this._overlayId = ariaUtilsDomOverlay.create(this.getDom(), options); } else { this.disposeProcessingIndicator(); } var processing = this._processing; if (processing) { // Update the value in the datamodel (someone else might be listening to it) this.__skipProcessingChange = true; this.__json.setValue(processing.inside, processing.to, visible); this.__skipProcessingChange = false; } } else if (visible) { // refresh the overlay ariaUtilsDomOverlay.overlays[this._overlayId].refresh(); } }
javascript
function (visible, options) { visible = !!visible; var alreadyVisible = !!this._overlayId; if (visible !== alreadyVisible) { if (visible) { this._overlayId = ariaUtilsDomOverlay.create(this.getDom(), options); } else { this.disposeProcessingIndicator(); } var processing = this._processing; if (processing) { // Update the value in the datamodel (someone else might be listening to it) this.__skipProcessingChange = true; this.__json.setValue(processing.inside, processing.to, visible); this.__skipProcessingChange = false; } } else if (visible) { // refresh the overlay ariaUtilsDomOverlay.overlays[this._overlayId].refresh(); } }
[ "function", "(", "visible", ",", "options", ")", "{", "visible", "=", "!", "!", "visible", ";", "var", "alreadyVisible", "=", "!", "!", "this", ".", "_overlayId", ";", "if", "(", "visible", "!==", "alreadyVisible", ")", "{", "if", "(", "visible", ")", "{", "this", ".", "_overlayId", "=", "ariaUtilsDomOverlay", ".", "create", "(", "this", ".", "getDom", "(", ")", ",", "options", ")", ";", "}", "else", "{", "this", ".", "disposeProcessingIndicator", "(", ")", ";", "}", "var", "processing", "=", "this", ".", "_processing", ";", "if", "(", "processing", ")", "{", "// Update the value in the datamodel (someone else might be listening to it)", "this", ".", "__skipProcessingChange", "=", "true", ";", "this", ".", "__json", ".", "setValue", "(", "processing", ".", "inside", ",", "processing", ".", "to", ",", "visible", ")", ";", "this", ".", "__skipProcessingChange", "=", "false", ";", "}", "}", "else", "if", "(", "visible", ")", "{", "// refresh the overlay", "ariaUtilsDomOverlay", ".", "overlays", "[", "this", ".", "_overlayId", "]", ".", "refresh", "(", ")", ";", "}", "}" ]
Set the state of the processing indicator. It updates the datamodel if the section has a processing binding @param {Boolean} visible True if the loading indicator should be visible @param {Object|String} options The options (see aria.utils.DomOverlay.create / aria.utils.DomOverlay.detachFrom)
[ "Set", "the", "state", "of", "the", "processing", "indicator", ".", "It", "updates", "the", "datamodel", "if", "the", "section", "has", "a", "processing", "binding" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L710-L732
27,357
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (recursive) { if (recursive) { var content = this._content; for (var i = 0, len = content.length; i < len; i++) { if (content[i].refreshProcessingIndicator) { content[i].refreshProcessingIndicator(true); } else if (content[i].behavior && content[i].behavior.subTplCtxt) { content[i].behavior.subTplCtxt.refreshProcessingIndicator(); } } } var processing = this._processing, isBound = !!processing; if (isBound && processing.inside[processing.to]) { // Display the loading indicator this._setProcessingIndicatorWithDefaultOptions(true); } }
javascript
function (recursive) { if (recursive) { var content = this._content; for (var i = 0, len = content.length; i < len; i++) { if (content[i].refreshProcessingIndicator) { content[i].refreshProcessingIndicator(true); } else if (content[i].behavior && content[i].behavior.subTplCtxt) { content[i].behavior.subTplCtxt.refreshProcessingIndicator(); } } } var processing = this._processing, isBound = !!processing; if (isBound && processing.inside[processing.to]) { // Display the loading indicator this._setProcessingIndicatorWithDefaultOptions(true); } }
[ "function", "(", "recursive", ")", "{", "if", "(", "recursive", ")", "{", "var", "content", "=", "this", ".", "_content", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "content", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "content", "[", "i", "]", ".", "refreshProcessingIndicator", ")", "{", "content", "[", "i", "]", ".", "refreshProcessingIndicator", "(", "true", ")", ";", "}", "else", "if", "(", "content", "[", "i", "]", ".", "behavior", "&&", "content", "[", "i", "]", ".", "behavior", ".", "subTplCtxt", ")", "{", "content", "[", "i", "]", ".", "behavior", ".", "subTplCtxt", ".", "refreshProcessingIndicator", "(", ")", ";", "}", "}", "}", "var", "processing", "=", "this", ".", "_processing", ",", "isBound", "=", "!", "!", "processing", ";", "if", "(", "isBound", "&&", "processing", ".", "inside", "[", "processing", ".", "to", "]", ")", "{", "// Display the loading indicator", "this", ".", "_setProcessingIndicatorWithDefaultOptions", "(", "true", ")", ";", "}", "}" ]
Refresh the status of the processing indicator above this section. This is called after a template refresh to display again the loading overlay above a section bound to the datamodel @param {Boolean} recursive if true the refresh is done on all subsections and subtemplates
[ "Refresh", "the", "status", "of", "the", "processing", "indicator", "above", "this", "section", ".", "This", "is", "called", "after", "a", "template", "refresh", "to", "display", "again", "the", "loading", "overlay", "above", "a", "section", "bound", "to", "the", "datamodel" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L748-L765
27,358
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (attributes) { var attrBinding = this._attributesBinding; if (attrBinding) { this.__json.setValue(attrBinding.inside, attrBinding.to, attributes); } else { this._applyNewAttributes(attributes); } }
javascript
function (attributes) { var attrBinding = this._attributesBinding; if (attrBinding) { this.__json.setValue(attrBinding.inside, attrBinding.to, attributes); } else { this._applyNewAttributes(attributes); } }
[ "function", "(", "attributes", ")", "{", "var", "attrBinding", "=", "this", ".", "_attributesBinding", ";", "if", "(", "attrBinding", ")", "{", "this", ".", "__json", ".", "setValue", "(", "attrBinding", ".", "inside", ",", "attrBinding", ".", "to", ",", "attributes", ")", ";", "}", "else", "{", "this", ".", "_applyNewAttributes", "(", "attributes", ")", ";", "}", "}" ]
Apply the new attributes by removing the current ones. If attributes are bound, the data model is updated @param {aria.templates.CfgBeans:HtmlAttribute} newValue @protected
[ "Apply", "the", "new", "attributes", "by", "removing", "the", "current", "ones", ".", "If", "attributes", "are", "bound", "the", "data", "model", "is", "updated" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L818-L825
27,359
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (newValue) { var attribute, domElt = this.getDom(), whiteList = ariaTemplatesDomElementWrapper.attributesWhiteList, newAttributeValue; var oldValue = this.attributes; // remove old members for (attribute in oldValue) { if (oldValue.hasOwnProperty(attribute)) { if (attribute == "dataset") { ariaUtilsHtml.removeDataset(domElt, oldValue[attribute]); } else if (!newValue[attribute]) { if (attribute == "classList") { this.getWrapper().classList.setClassName(""); } else { domElt.removeAttribute(attribute); } } } } // add new members for (attribute in newValue) { newAttributeValue = newValue[attribute]; if (newValue.hasOwnProperty(attribute) && !this.__json.isMetadata(attribute) && newAttributeValue != null) { if (attribute == "classList") { this.getWrapper().classList.setClassName(newAttributeValue.join(" ")); } else if (attribute == "dataset") { ariaUtilsHtml.setDataset(domElt, newAttributeValue); } else if (whiteList.test(attribute) && newAttributeValue !== oldValue[attribute]) { domElt.setAttribute(attribute, newAttributeValue); } } } this.attributes = this.__json.copy(newValue); }
javascript
function (newValue) { var attribute, domElt = this.getDom(), whiteList = ariaTemplatesDomElementWrapper.attributesWhiteList, newAttributeValue; var oldValue = this.attributes; // remove old members for (attribute in oldValue) { if (oldValue.hasOwnProperty(attribute)) { if (attribute == "dataset") { ariaUtilsHtml.removeDataset(domElt, oldValue[attribute]); } else if (!newValue[attribute]) { if (attribute == "classList") { this.getWrapper().classList.setClassName(""); } else { domElt.removeAttribute(attribute); } } } } // add new members for (attribute in newValue) { newAttributeValue = newValue[attribute]; if (newValue.hasOwnProperty(attribute) && !this.__json.isMetadata(attribute) && newAttributeValue != null) { if (attribute == "classList") { this.getWrapper().classList.setClassName(newAttributeValue.join(" ")); } else if (attribute == "dataset") { ariaUtilsHtml.setDataset(domElt, newAttributeValue); } else if (whiteList.test(attribute) && newAttributeValue !== oldValue[attribute]) { domElt.setAttribute(attribute, newAttributeValue); } } } this.attributes = this.__json.copy(newValue); }
[ "function", "(", "newValue", ")", "{", "var", "attribute", ",", "domElt", "=", "this", ".", "getDom", "(", ")", ",", "whiteList", "=", "ariaTemplatesDomElementWrapper", ".", "attributesWhiteList", ",", "newAttributeValue", ";", "var", "oldValue", "=", "this", ".", "attributes", ";", "// remove old members", "for", "(", "attribute", "in", "oldValue", ")", "{", "if", "(", "oldValue", ".", "hasOwnProperty", "(", "attribute", ")", ")", "{", "if", "(", "attribute", "==", "\"dataset\"", ")", "{", "ariaUtilsHtml", ".", "removeDataset", "(", "domElt", ",", "oldValue", "[", "attribute", "]", ")", ";", "}", "else", "if", "(", "!", "newValue", "[", "attribute", "]", ")", "{", "if", "(", "attribute", "==", "\"classList\"", ")", "{", "this", ".", "getWrapper", "(", ")", ".", "classList", ".", "setClassName", "(", "\"\"", ")", ";", "}", "else", "{", "domElt", ".", "removeAttribute", "(", "attribute", ")", ";", "}", "}", "}", "}", "// add new members", "for", "(", "attribute", "in", "newValue", ")", "{", "newAttributeValue", "=", "newValue", "[", "attribute", "]", ";", "if", "(", "newValue", ".", "hasOwnProperty", "(", "attribute", ")", "&&", "!", "this", ".", "__json", ".", "isMetadata", "(", "attribute", ")", "&&", "newAttributeValue", "!=", "null", ")", "{", "if", "(", "attribute", "==", "\"classList\"", ")", "{", "this", ".", "getWrapper", "(", ")", ".", "classList", ".", "setClassName", "(", "newAttributeValue", ".", "join", "(", "\" \"", ")", ")", ";", "}", "else", "if", "(", "attribute", "==", "\"dataset\"", ")", "{", "ariaUtilsHtml", ".", "setDataset", "(", "domElt", ",", "newAttributeValue", ")", ";", "}", "else", "if", "(", "whiteList", ".", "test", "(", "attribute", ")", "&&", "newAttributeValue", "!==", "oldValue", "[", "attribute", "]", ")", "{", "domElt", ".", "setAttribute", "(", "attribute", ",", "newAttributeValue", ")", ";", "}", "}", "}", "this", ".", "attributes", "=", "this", ".", "__json", ".", "copy", "(", "newValue", ")", ";", "}" ]
Apply the new attributes by removing the current ones. Even if attributes are bound, the data model is not updated @param {aria.templates.CfgBeans:HtmlAttribute} newValue @protected
[ "Apply", "the", "new", "attributes", "by", "removing", "the", "current", "ones", ".", "Even", "if", "attributes", "are", "bound", "the", "data", "model", "is", "not", "updated" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L833-L868
27,360
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (className) { if (this.attributes && this.attributes.classList) { this.attributes.classList = className.split(" "); var attrBinding = this._attributesBinding; if (attrBinding) { this.__json.setValue(attrBinding.inside[attrBinding.to], "classList", className.split(" "), this._attributesChangeListener); } } }
javascript
function (className) { if (this.attributes && this.attributes.classList) { this.attributes.classList = className.split(" "); var attrBinding = this._attributesBinding; if (attrBinding) { this.__json.setValue(attrBinding.inside[attrBinding.to], "classList", className.split(" "), this._attributesChangeListener); } } }
[ "function", "(", "className", ")", "{", "if", "(", "this", ".", "attributes", "&&", "this", ".", "attributes", ".", "classList", ")", "{", "this", ".", "attributes", ".", "classList", "=", "className", ".", "split", "(", "\" \"", ")", ";", "var", "attrBinding", "=", "this", ".", "_attributesBinding", ";", "if", "(", "attrBinding", ")", "{", "this", ".", "__json", ".", "setValue", "(", "attrBinding", ".", "inside", "[", "attrBinding", ".", "to", "]", ",", "\"classList\"", ",", "className", ".", "split", "(", "\" \"", ")", ",", "this", ".", "_attributesChangeListener", ")", ";", "}", "}", "}" ]
Update the section object variables that are linked to the className of the HTML element representing the section in the DOM. It does not update the HTML class attribute, but should be called only after it has been updated by another entity. @param {String} className
[ "Update", "the", "section", "object", "variables", "that", "are", "linked", "to", "the", "className", "of", "the", "HTML", "element", "representing", "the", "section", "in", "the", "DOM", ".", "It", "does", "not", "update", "the", "HTML", "class", "attribute", "but", "should", "be", "called", "only", "after", "it", "has", "been", "updated", "by", "another", "entity", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L876-L884
27,361
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (out) { if (this.domType) { // if domType is empty, we do not output anything for the section // (used in the tooltip) var attributeList = this.attributes ? ariaUtilsHtml.buildAttributeList(this.attributes) : ''; var h = ['<', this.domType, attributeList, ' id="', this._domId, '" ', ariaUtilsDelegate.getMarkup(this.delegateId), '>']; out.write(h.join(''));// opening the section } }
javascript
function (out) { if (this.domType) { // if domType is empty, we do not output anything for the section // (used in the tooltip) var attributeList = this.attributes ? ariaUtilsHtml.buildAttributeList(this.attributes) : ''; var h = ['<', this.domType, attributeList, ' id="', this._domId, '" ', ariaUtilsDelegate.getMarkup(this.delegateId), '>']; out.write(h.join(''));// opening the section } }
[ "function", "(", "out", ")", "{", "if", "(", "this", ".", "domType", ")", "{", "// if domType is empty, we do not output anything for the section", "// (used in the tooltip)", "var", "attributeList", "=", "this", ".", "attributes", "?", "ariaUtilsHtml", ".", "buildAttributeList", "(", "this", ".", "attributes", ")", ":", "''", ";", "var", "h", "=", "[", "'<'", ",", "this", ".", "domType", ",", "attributeList", ",", "' id=\"'", ",", "this", ".", "_domId", ",", "'\" '", ",", "ariaUtilsDelegate", ".", "getMarkup", "(", "this", ".", "delegateId", ")", ",", "'>'", "]", ";", "out", ".", "write", "(", "h", ".", "join", "(", "''", ")", ")", ";", "// opening the section", "}", "}" ]
Write the beginning of the DOM source for the section container @param {aria.templates.MarkupWriter} out
[ "Write", "the", "beginning", "of", "the", "DOM", "source", "for", "the", "section", "container" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L928-L937
27,362
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (evt) { // forward event and configuration to a dedicated handler this.__navigationManager.handleNavigation(this.keyMap, this.tableNav, evt); if (this._cfg && this._cfg.on) { var callback = this._cfg.on[evt.type]; if (callback) { var wrapped = new ariaTemplatesDomEventWrapper(evt), returnValue; try { returnValue = callback.fn.call(callback.scope, wrapped, callback.args); } catch (e) { this.$logError(this.SECTION_CALLBACK_ERROR, [this.tplCtxt.tplClasspath, this._cfg.id, evt.type], e); } wrapped.$dispose(); return returnValue; } } }
javascript
function (evt) { // forward event and configuration to a dedicated handler this.__navigationManager.handleNavigation(this.keyMap, this.tableNav, evt); if (this._cfg && this._cfg.on) { var callback = this._cfg.on[evt.type]; if (callback) { var wrapped = new ariaTemplatesDomEventWrapper(evt), returnValue; try { returnValue = callback.fn.call(callback.scope, wrapped, callback.args); } catch (e) { this.$logError(this.SECTION_CALLBACK_ERROR, [this.tplCtxt.tplClasspath, this._cfg.id, evt.type], e); } wrapped.$dispose(); return returnValue; } } }
[ "function", "(", "evt", ")", "{", "// forward event and configuration to a dedicated handler", "this", ".", "__navigationManager", ".", "handleNavigation", "(", "this", ".", "keyMap", ",", "this", ".", "tableNav", ",", "evt", ")", ";", "if", "(", "this", ".", "_cfg", "&&", "this", ".", "_cfg", ".", "on", ")", "{", "var", "callback", "=", "this", ".", "_cfg", ".", "on", "[", "evt", ".", "type", "]", ";", "if", "(", "callback", ")", "{", "var", "wrapped", "=", "new", "ariaTemplatesDomEventWrapper", "(", "evt", ")", ",", "returnValue", ";", "try", "{", "returnValue", "=", "callback", ".", "fn", ".", "call", "(", "callback", ".", "scope", ",", "wrapped", ",", "callback", ".", "args", ")", ";", "}", "catch", "(", "e", ")", "{", "this", ".", "$logError", "(", "this", ".", "SECTION_CALLBACK_ERROR", ",", "[", "this", ".", "tplCtxt", ".", "tplClasspath", ",", "this", ".", "_cfg", ".", "id", ",", "evt", ".", "type", "]", ",", "e", ")", ";", "}", "wrapped", ".", "$dispose", "(", ")", ";", "return", "returnValue", ";", "}", "}", "}" ]
Event handler for keyboard navigation @param {aria.DomEvent} evt
[ "Event", "handler", "for", "keyboard", "navigation" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L954-L972
27,363
ariatemplates/ariatemplates
src/aria/templates/Section.js
function () { var eventListeners = this._cfg ? this._cfg.on : null; if (eventListeners) { for (var listener in eventListeners) { if (eventListeners.hasOwnProperty(listener)) { eventListeners[listener] = this.$normCallback(eventListeners[listener]); } } } }
javascript
function () { var eventListeners = this._cfg ? this._cfg.on : null; if (eventListeners) { for (var listener in eventListeners) { if (eventListeners.hasOwnProperty(listener)) { eventListeners[listener] = this.$normCallback(eventListeners[listener]); } } } }
[ "function", "(", ")", "{", "var", "eventListeners", "=", "this", ".", "_cfg", "?", "this", ".", "_cfg", ".", "on", ":", "null", ";", "if", "(", "eventListeners", ")", "{", "for", "(", "var", "listener", "in", "eventListeners", ")", "{", "if", "(", "eventListeners", ".", "hasOwnProperty", "(", "listener", ")", ")", "{", "eventListeners", "[", "listener", "]", "=", "this", ".", "$normCallback", "(", "eventListeners", "[", "listener", "]", ")", ";", "}", "}", "}", "}" ]
Since event's callback can have several signatures as specified in aria.widgetLibs.CommonBeans.Callback this function normalizes the callbacks for later use. It will also ask Delegate to generate a delegateId if needed. @protected
[ "Since", "event", "s", "callback", "can", "have", "several", "signatures", "as", "specified", "in", "aria", ".", "widgetLibs", ".", "CommonBeans", ".", "Callback", "this", "function", "normalizes", "the", "callbacks", "for", "later", "use", ".", "It", "will", "also", "ask", "Delegate", "to", "generate", "a", "delegateId", "if", "needed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L979-L988
27,364
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (targetSection) { this.$assert(708, targetSection.idMap == null); // check that there is no id map so that it is not a // problem to change the id targetSection.id = this.id; targetSection.domType = this.domType; targetSection.tableNav = this.tableNav; targetSection.keyMap = this.keyMap; targetSection.macro = this.macro; }
javascript
function (targetSection) { this.$assert(708, targetSection.idMap == null); // check that there is no id map so that it is not a // problem to change the id targetSection.id = this.id; targetSection.domType = this.domType; targetSection.tableNav = this.tableNav; targetSection.keyMap = this.keyMap; targetSection.macro = this.macro; }
[ "function", "(", "targetSection", ")", "{", "this", ".", "$assert", "(", "708", ",", "targetSection", ".", "idMap", "==", "null", ")", ";", "// check that there is no id map so that it is not a", "// problem to change the id", "targetSection", ".", "id", "=", "this", ".", "id", ";", "targetSection", ".", "domType", "=", "this", ".", "domType", ";", "targetSection", ".", "tableNav", "=", "this", ".", "tableNav", ";", "targetSection", ".", "keyMap", "=", "this", ".", "keyMap", ";", "targetSection", ".", "macro", "=", "this", ".", "macro", ";", "}" ]
Copy this section configuration on another section. Note that this method should only be used with targetSections that have no idMap. @param {aria.templates.Section} targetSection
[ "Copy", "this", "section", "configuration", "on", "another", "section", ".", "Note", "that", "this", "method", "should", "only", "be", "used", "with", "targetSections", "that", "have", "no", "idMap", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L995-L1003
27,365
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (args) { var sectionMacro = this.macro; if (sectionMacro) { // a macro is defined in the section, it is the default macro to use when refreshing if (!args.macro) { args.macro = sectionMacro; } else { var targetMacro = args.macro; if (ariaUtilsType.isObject(targetMacro) && !targetMacro.name) { targetMacro.name = sectionMacro.name; targetMacro.scope = sectionMacro.scope; if (!targetMacro.args) { targetMacro.args = sectionMacro.args; } } } } // Remove cached reference to the dom element, as it may change during the refresh // (occurs in tables in IE) this._domElt = null; }
javascript
function (args) { var sectionMacro = this.macro; if (sectionMacro) { // a macro is defined in the section, it is the default macro to use when refreshing if (!args.macro) { args.macro = sectionMacro; } else { var targetMacro = args.macro; if (ariaUtilsType.isObject(targetMacro) && !targetMacro.name) { targetMacro.name = sectionMacro.name; targetMacro.scope = sectionMacro.scope; if (!targetMacro.args) { targetMacro.args = sectionMacro.args; } } } } // Remove cached reference to the dom element, as it may change during the refresh // (occurs in tables in IE) this._domElt = null; }
[ "function", "(", "args", ")", "{", "var", "sectionMacro", "=", "this", ".", "macro", ";", "if", "(", "sectionMacro", ")", "{", "// a macro is defined in the section, it is the default macro to use when refreshing", "if", "(", "!", "args", ".", "macro", ")", "{", "args", ".", "macro", "=", "sectionMacro", ";", "}", "else", "{", "var", "targetMacro", "=", "args", ".", "macro", ";", "if", "(", "ariaUtilsType", ".", "isObject", "(", "targetMacro", ")", "&&", "!", "targetMacro", ".", "name", ")", "{", "targetMacro", ".", "name", "=", "sectionMacro", ".", "name", ";", "targetMacro", ".", "scope", "=", "sectionMacro", ".", "scope", ";", "if", "(", "!", "targetMacro", ".", "args", ")", "{", "targetMacro", ".", "args", "=", "sectionMacro", ".", "args", ";", "}", "}", "}", "}", "// Remove cached reference to the dom element, as it may change during the refresh", "// (occurs in tables in IE)", "this", ".", "_domElt", "=", "null", ";", "}" ]
Method called when this section is about to be refreshed. @param {aria.templates.CfgBeans:GetRefreshedSectionCfg} args arguments given to the getRefreshedSection method. The arguments are modified to add default parameters (macro) if not specified.
[ "Method", "called", "when", "this", "section", "is", "about", "to", "be", "refreshed", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L1061-L1081
27,366
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (targetSection) { var content = this._content; this.$assert(805, this.idMap == null); this.$assert(806, content); var targetContent = targetSection._content; var targetLength = targetContent.length; // first move all children from this to target _content array // updating the parent reference for sections for (var i = 0, l = content.length; i < l; i++) { var item = content[i]; targetContent[targetLength + i] = item; if (item._type == TYPE_SECTION) { item.parent = targetSection; } } // then register content in the target idMap this.__updateIdMap(targetSection.idMap); // move the {on...} statement callbacks: targetSection.delegateIds = targetSection.delegateIds.concat(this.delegateIds); targetSection.delegateCallbacks = targetSection.delegateCallbacks.concat(this.delegateCallbacks); this.delegateIds = []; this.delegateCallbacks = []; // and initialize widgets var res = null; if (targetSection._initWidgetsDone) { res = this.initWidgets(); } // set back idMap to null (may have been changed by __updateIdMap) this.idMap = null; // this section becomes empty: this._content = []; return res; }
javascript
function (targetSection) { var content = this._content; this.$assert(805, this.idMap == null); this.$assert(806, content); var targetContent = targetSection._content; var targetLength = targetContent.length; // first move all children from this to target _content array // updating the parent reference for sections for (var i = 0, l = content.length; i < l; i++) { var item = content[i]; targetContent[targetLength + i] = item; if (item._type == TYPE_SECTION) { item.parent = targetSection; } } // then register content in the target idMap this.__updateIdMap(targetSection.idMap); // move the {on...} statement callbacks: targetSection.delegateIds = targetSection.delegateIds.concat(this.delegateIds); targetSection.delegateCallbacks = targetSection.delegateCallbacks.concat(this.delegateCallbacks); this.delegateIds = []; this.delegateCallbacks = []; // and initialize widgets var res = null; if (targetSection._initWidgetsDone) { res = this.initWidgets(); } // set back idMap to null (may have been changed by __updateIdMap) this.idMap = null; // this section becomes empty: this._content = []; return res; }
[ "function", "(", "targetSection", ")", "{", "var", "content", "=", "this", ".", "_content", ";", "this", ".", "$assert", "(", "805", ",", "this", ".", "idMap", "==", "null", ")", ";", "this", ".", "$assert", "(", "806", ",", "content", ")", ";", "var", "targetContent", "=", "targetSection", ".", "_content", ";", "var", "targetLength", "=", "targetContent", ".", "length", ";", "// first move all children from this to target _content array", "// updating the parent reference for sections", "for", "(", "var", "i", "=", "0", ",", "l", "=", "content", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "var", "item", "=", "content", "[", "i", "]", ";", "targetContent", "[", "targetLength", "+", "i", "]", "=", "item", ";", "if", "(", "item", ".", "_type", "==", "TYPE_SECTION", ")", "{", "item", ".", "parent", "=", "targetSection", ";", "}", "}", "// then register content in the target idMap", "this", ".", "__updateIdMap", "(", "targetSection", ".", "idMap", ")", ";", "// move the {on...} statement callbacks:", "targetSection", ".", "delegateIds", "=", "targetSection", ".", "delegateIds", ".", "concat", "(", "this", ".", "delegateIds", ")", ";", "targetSection", ".", "delegateCallbacks", "=", "targetSection", ".", "delegateCallbacks", ".", "concat", "(", "this", ".", "delegateCallbacks", ")", ";", "this", ".", "delegateIds", "=", "[", "]", ";", "this", ".", "delegateCallbacks", "=", "[", "]", ";", "// and initialize widgets", "var", "res", "=", "null", ";", "if", "(", "targetSection", ".", "_initWidgetsDone", ")", "{", "res", "=", "this", ".", "initWidgets", "(", ")", ";", "}", "// set back idMap to null (may have been changed by __updateIdMap)", "this", ".", "idMap", "=", "null", ";", "// this section becomes empty:", "this", ".", "_content", "=", "[", "]", ";", "return", "res", ";", "}" ]
Move the content of this section to another section, and initialize section widgets if widgets are already initialized in the target section. Note that this method should only be used on sections with no idMap. @param {aria.templates.Section} targetSection @return {Array} List of element that will be rendered later on
[ "Move", "the", "content", "of", "this", "section", "to", "another", "section", "and", "initialize", "section", "widgets", "if", "widgets", "are", "already", "initialized", "in", "the", "target", "section", ".", "Note", "that", "this", "method", "should", "only", "be", "used", "on", "sections", "with", "no", "idMap", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L1142-L1177
27,367
ariatemplates/ariatemplates
src/aria/templates/Section.js
function () { var splitted1 = this._cfg.animation.animateIn.split(" "); var splitted2 = this._cfg.animation.animateOut.split(" "); return { animIn : { type : splitted1[0], reverse : (splitted1[1] == "right") }, animOut : { type : splitted2[0], reverse : (splitted2[1] == "right") } }; }
javascript
function () { var splitted1 = this._cfg.animation.animateIn.split(" "); var splitted2 = this._cfg.animation.animateOut.split(" "); return { animIn : { type : splitted1[0], reverse : (splitted1[1] == "right") }, animOut : { type : splitted2[0], reverse : (splitted2[1] == "right") } }; }
[ "function", "(", ")", "{", "var", "splitted1", "=", "this", ".", "_cfg", ".", "animation", ".", "animateIn", ".", "split", "(", "\" \"", ")", ";", "var", "splitted2", "=", "this", ".", "_cfg", ".", "animation", ".", "animateOut", ".", "split", "(", "\" \"", ")", ";", "return", "{", "animIn", ":", "{", "type", ":", "splitted1", "[", "0", "]", ",", "reverse", ":", "(", "splitted1", "[", "1", "]", "==", "\"right\"", ")", "}", ",", "animOut", ":", "{", "type", ":", "splitted2", "[", "0", "]", ",", "reverse", ":", "(", "splitted2", "[", "1", "]", "==", "\"right\"", ")", "}", "}", ";", "}" ]
Returns an object containing the animation type and direction.
[ "Returns", "an", "object", "containing", "the", "animation", "type", "and", "direction", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L1223-L1236
27,368
ariatemplates/ariatemplates
src/aria/templates/Section.js
function (domElt, refreshArgs) { // lazy processing of animation in/out string var animation = this._getAnimation(); this._animating = true; var newSection = this._domElt.cloneNode(false); domElt.id = null; newSection.className += " not-visible"; newSection = ariaUtilsDom.replaceHTML(newSection, this.html); var from = domElt; var to = newSection; ariaUtilsDom.insertAdjacentElement(from, "afterEnd", newSection); this.setDom(newSection); var animSemaphore = false; var cfg = { // from : from, to : to, type : 3, reverse : animation.animIn.reverse, hiddenClass : 'not-visible' }; var cfg2 = { from : from, // to : to, type : 3, reverse : animation.animOut.reverse, hiddenClass : 'not-visible' }; var anim = new ariaUtilsCssAnimations(); var anim2 = new ariaUtilsCssAnimations(); var animEnd = { "animationend" : function () { if (animSemaphore) { ariaUtilsDom.removeElement(from); this._animating = false; this.tplCtxt.onRefreshAnimationEnd(refreshArgs); } else { animSemaphore = true; } }, scope : this }; anim.$on(animEnd); anim2.$on(animEnd); anim.start(animation.animIn.type, cfg); anim2.start(animation.animOut.type, cfg2); }
javascript
function (domElt, refreshArgs) { // lazy processing of animation in/out string var animation = this._getAnimation(); this._animating = true; var newSection = this._domElt.cloneNode(false); domElt.id = null; newSection.className += " not-visible"; newSection = ariaUtilsDom.replaceHTML(newSection, this.html); var from = domElt; var to = newSection; ariaUtilsDom.insertAdjacentElement(from, "afterEnd", newSection); this.setDom(newSection); var animSemaphore = false; var cfg = { // from : from, to : to, type : 3, reverse : animation.animIn.reverse, hiddenClass : 'not-visible' }; var cfg2 = { from : from, // to : to, type : 3, reverse : animation.animOut.reverse, hiddenClass : 'not-visible' }; var anim = new ariaUtilsCssAnimations(); var anim2 = new ariaUtilsCssAnimations(); var animEnd = { "animationend" : function () { if (animSemaphore) { ariaUtilsDom.removeElement(from); this._animating = false; this.tplCtxt.onRefreshAnimationEnd(refreshArgs); } else { animSemaphore = true; } }, scope : this }; anim.$on(animEnd); anim2.$on(animEnd); anim.start(animation.animIn.type, cfg); anim2.start(animation.animOut.type, cfg2); }
[ "function", "(", "domElt", ",", "refreshArgs", ")", "{", "// lazy processing of animation in/out string", "var", "animation", "=", "this", ".", "_getAnimation", "(", ")", ";", "this", ".", "_animating", "=", "true", ";", "var", "newSection", "=", "this", ".", "_domElt", ".", "cloneNode", "(", "false", ")", ";", "domElt", ".", "id", "=", "null", ";", "newSection", ".", "className", "+=", "\" not-visible\"", ";", "newSection", "=", "ariaUtilsDom", ".", "replaceHTML", "(", "newSection", ",", "this", ".", "html", ")", ";", "var", "from", "=", "domElt", ";", "var", "to", "=", "newSection", ";", "ariaUtilsDom", ".", "insertAdjacentElement", "(", "from", ",", "\"afterEnd\"", ",", "newSection", ")", ";", "this", ".", "setDom", "(", "newSection", ")", ";", "var", "animSemaphore", "=", "false", ";", "var", "cfg", "=", "{", "// from : from,", "to", ":", "to", ",", "type", ":", "3", ",", "reverse", ":", "animation", ".", "animIn", ".", "reverse", ",", "hiddenClass", ":", "'not-visible'", "}", ";", "var", "cfg2", "=", "{", "from", ":", "from", ",", "// to : to,", "type", ":", "3", ",", "reverse", ":", "animation", ".", "animOut", ".", "reverse", ",", "hiddenClass", ":", "'not-visible'", "}", ";", "var", "anim", "=", "new", "ariaUtilsCssAnimations", "(", ")", ";", "var", "anim2", "=", "new", "ariaUtilsCssAnimations", "(", ")", ";", "var", "animEnd", "=", "{", "\"animationend\"", ":", "function", "(", ")", "{", "if", "(", "animSemaphore", ")", "{", "ariaUtilsDom", ".", "removeElement", "(", "from", ")", ";", "this", ".", "_animating", "=", "false", ";", "this", ".", "tplCtxt", ".", "onRefreshAnimationEnd", "(", "refreshArgs", ")", ";", "}", "else", "{", "animSemaphore", "=", "true", ";", "}", "}", ",", "scope", ":", "this", "}", ";", "anim", ".", "$on", "(", "animEnd", ")", ";", "anim2", ".", "$on", "(", "animEnd", ")", ";", "anim", ".", "start", "(", "animation", ".", "animIn", ".", "type", ",", "cfg", ")", ";", "anim2", ".", "start", "(", "animation", ".", "animOut", ".", "type", ",", "cfg2", ")", ";", "}" ]
Prepares and performs the transition animation from a section to another one. @param {HTMLElement} domElt element to be animated @param {Object} refreshArgs parameter provided to the template onRefreshAnimationEnd handler
[ "Prepares", "and", "performs", "the", "transition", "animation", "from", "a", "section", "to", "another", "one", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/templates/Section.js#L1243-L1295
27,369
ariatemplates/ariatemplates
src/aria/resources/handlers/LCResourcesHandler.js
function (suggestions) { if (typesUtil.isArray(suggestions)) { var newSuggestions = [], suggestionsLabel = this._options.labelKey, suggestionsCode = this._options.codeKey; if (this._options.sortingMethod && typesUtil.isFunction(this._options.sortingMethod)) { suggestions.sort(this._options.sortingMethod); } else { suggestions.sort(function (a, b) { return (a[suggestionsLabel] < b[suggestionsLabel]) ? 1 : (a[suggestionsLabel] > b[suggestionsLabel]) ? -1 : 0; }); } for (var index = 0, l = suggestions.length; index < l; index++) { var suggestion = suggestions[index], eachSuggestion = {}; if (this.__islabelCode && !jsonValidator.check(suggestion, this.SUGGESTION_BEAN)) { return this.$logError(this.INVALID_SUGGESTIONS, null, suggestions); } else if (!(suggestion.hasOwnProperty(suggestionsLabel) && suggestion.hasOwnProperty(suggestionsCode))) { return this.$logError(this.INVALID_KEYCODE, null, suggestions); } eachSuggestion.label = suggestion[suggestionsLabel]; eachSuggestion.code = suggestion[suggestionsCode]; var newSuggestion = { label : stringUtil.stripAccents(eachSuggestion.label).toLowerCase(), code : stringUtil.stripAccents(eachSuggestion.code).toLowerCase(), original : eachSuggestion }; if (this._labelMatchAtWordBoundaries) { newSuggestion.wordBoundaries = this.__getWordBoundaries(newSuggestion.label); } newSuggestions.push(newSuggestion); } this._suggestions = newSuggestions; } else { return this.$logError(this.INVALD_SUGGESTION_TYPE, null, suggestions); } }
javascript
function (suggestions) { if (typesUtil.isArray(suggestions)) { var newSuggestions = [], suggestionsLabel = this._options.labelKey, suggestionsCode = this._options.codeKey; if (this._options.sortingMethod && typesUtil.isFunction(this._options.sortingMethod)) { suggestions.sort(this._options.sortingMethod); } else { suggestions.sort(function (a, b) { return (a[suggestionsLabel] < b[suggestionsLabel]) ? 1 : (a[suggestionsLabel] > b[suggestionsLabel]) ? -1 : 0; }); } for (var index = 0, l = suggestions.length; index < l; index++) { var suggestion = suggestions[index], eachSuggestion = {}; if (this.__islabelCode && !jsonValidator.check(suggestion, this.SUGGESTION_BEAN)) { return this.$logError(this.INVALID_SUGGESTIONS, null, suggestions); } else if (!(suggestion.hasOwnProperty(suggestionsLabel) && suggestion.hasOwnProperty(suggestionsCode))) { return this.$logError(this.INVALID_KEYCODE, null, suggestions); } eachSuggestion.label = suggestion[suggestionsLabel]; eachSuggestion.code = suggestion[suggestionsCode]; var newSuggestion = { label : stringUtil.stripAccents(eachSuggestion.label).toLowerCase(), code : stringUtil.stripAccents(eachSuggestion.code).toLowerCase(), original : eachSuggestion }; if (this._labelMatchAtWordBoundaries) { newSuggestion.wordBoundaries = this.__getWordBoundaries(newSuggestion.label); } newSuggestions.push(newSuggestion); } this._suggestions = newSuggestions; } else { return this.$logError(this.INVALD_SUGGESTION_TYPE, null, suggestions); } }
[ "function", "(", "suggestions", ")", "{", "if", "(", "typesUtil", ".", "isArray", "(", "suggestions", ")", ")", "{", "var", "newSuggestions", "=", "[", "]", ",", "suggestionsLabel", "=", "this", ".", "_options", ".", "labelKey", ",", "suggestionsCode", "=", "this", ".", "_options", ".", "codeKey", ";", "if", "(", "this", ".", "_options", ".", "sortingMethod", "&&", "typesUtil", ".", "isFunction", "(", "this", ".", "_options", ".", "sortingMethod", ")", ")", "{", "suggestions", ".", "sort", "(", "this", ".", "_options", ".", "sortingMethod", ")", ";", "}", "else", "{", "suggestions", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "return", "(", "a", "[", "suggestionsLabel", "]", "<", "b", "[", "suggestionsLabel", "]", ")", "?", "1", ":", "(", "a", "[", "suggestionsLabel", "]", ">", "b", "[", "suggestionsLabel", "]", ")", "?", "-", "1", ":", "0", ";", "}", ")", ";", "}", "for", "(", "var", "index", "=", "0", ",", "l", "=", "suggestions", ".", "length", ";", "index", "<", "l", ";", "index", "++", ")", "{", "var", "suggestion", "=", "suggestions", "[", "index", "]", ",", "eachSuggestion", "=", "{", "}", ";", "if", "(", "this", ".", "__islabelCode", "&&", "!", "jsonValidator", ".", "check", "(", "suggestion", ",", "this", ".", "SUGGESTION_BEAN", ")", ")", "{", "return", "this", ".", "$logError", "(", "this", ".", "INVALID_SUGGESTIONS", ",", "null", ",", "suggestions", ")", ";", "}", "else", "if", "(", "!", "(", "suggestion", ".", "hasOwnProperty", "(", "suggestionsLabel", ")", "&&", "suggestion", ".", "hasOwnProperty", "(", "suggestionsCode", ")", ")", ")", "{", "return", "this", ".", "$logError", "(", "this", ".", "INVALID_KEYCODE", ",", "null", ",", "suggestions", ")", ";", "}", "eachSuggestion", ".", "label", "=", "suggestion", "[", "suggestionsLabel", "]", ";", "eachSuggestion", ".", "code", "=", "suggestion", "[", "suggestionsCode", "]", ";", "var", "newSuggestion", "=", "{", "label", ":", "stringUtil", ".", "stripAccents", "(", "eachSuggestion", ".", "label", ")", ".", "toLowerCase", "(", ")", ",", "code", ":", "stringUtil", ".", "stripAccents", "(", "eachSuggestion", ".", "code", ")", ".", "toLowerCase", "(", ")", ",", "original", ":", "eachSuggestion", "}", ";", "if", "(", "this", ".", "_labelMatchAtWordBoundaries", ")", "{", "newSuggestion", ".", "wordBoundaries", "=", "this", ".", "__getWordBoundaries", "(", "newSuggestion", ".", "label", ")", ";", "}", "newSuggestions", ".", "push", "(", "newSuggestion", ")", ";", "}", "this", ".", "_suggestions", "=", "newSuggestions", ";", "}", "else", "{", "return", "this", ".", "$logError", "(", "this", ".", "INVALD_SUGGESTION_TYPE", ",", "null", ",", "suggestions", ")", ";", "}", "}" ]
Set the list of available suggestion @param {Array} suggestions list of suggestion objects
[ "Set", "the", "list", "of", "available", "suggestion" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/resources/handlers/LCResourcesHandler.js#L204-L244
27,370
ariatemplates/ariatemplates
src/aria/resources/handlers/LCResourcesHandler.js
function (callback) { var originalSuggestions = this._suggestions; var nbSuggestions = originalSuggestions.length; var returnedSuggestions = []; var suggestion; for (var index = 0; index < nbSuggestions; index++) { suggestion = originalSuggestions[index]; returnedSuggestions.push(suggestion.original); } this.$callback(callback, returnedSuggestions); }
javascript
function (callback) { var originalSuggestions = this._suggestions; var nbSuggestions = originalSuggestions.length; var returnedSuggestions = []; var suggestion; for (var index = 0; index < nbSuggestions; index++) { suggestion = originalSuggestions[index]; returnedSuggestions.push(suggestion.original); } this.$callback(callback, returnedSuggestions); }
[ "function", "(", "callback", ")", "{", "var", "originalSuggestions", "=", "this", ".", "_suggestions", ";", "var", "nbSuggestions", "=", "originalSuggestions", ".", "length", ";", "var", "returnedSuggestions", "=", "[", "]", ";", "var", "suggestion", ";", "for", "(", "var", "index", "=", "0", ";", "index", "<", "nbSuggestions", ";", "index", "++", ")", "{", "suggestion", "=", "originalSuggestions", "[", "index", "]", ";", "returnedSuggestions", ".", "push", "(", "suggestion", ".", "original", ")", ";", "}", "this", ".", "$callback", "(", "callback", ",", "returnedSuggestions", ")", ";", "}" ]
Call the callback with all possible suggestions. @param {aria.core.CfgBeans:Callback} callback
[ "Call", "the", "callback", "with", "all", "possible", "suggestions", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/resources/handlers/LCResourcesHandler.js#L266-L276
27,371
ariatemplates/ariatemplates
src/aria/pageEngine/utils/PageConfigHelper.js
function (lazy) { var dependencies = { templates : [], classes : [], modules : { page : [], common : [] }, css : [] }; var pageComposition = this._pageConfig.pageComposition; var placeholders = pageComposition.placeholders || {}; var typeUtils = ariaUtilsType; if (!lazy) { this._utils.addIfMissing(pageComposition.template, dependencies.templates); if (pageComposition.css) { dependencies.css = pageComposition.css.slice(0); } } for (var placeholderName in placeholders) { if (placeholders.hasOwnProperty(placeholderName)) { var singlePlaceholderArray = placeholders[placeholderName]; if (!typeUtils.isArray(singlePlaceholderArray)) { singlePlaceholderArray = [singlePlaceholderArray]; } for (var i = 0; i < singlePlaceholderArray.length; i += 1) { this._addPlaceholderDependencies(singlePlaceholderArray[i], dependencies, lazy); } } } return dependencies; }
javascript
function (lazy) { var dependencies = { templates : [], classes : [], modules : { page : [], common : [] }, css : [] }; var pageComposition = this._pageConfig.pageComposition; var placeholders = pageComposition.placeholders || {}; var typeUtils = ariaUtilsType; if (!lazy) { this._utils.addIfMissing(pageComposition.template, dependencies.templates); if (pageComposition.css) { dependencies.css = pageComposition.css.slice(0); } } for (var placeholderName in placeholders) { if (placeholders.hasOwnProperty(placeholderName)) { var singlePlaceholderArray = placeholders[placeholderName]; if (!typeUtils.isArray(singlePlaceholderArray)) { singlePlaceholderArray = [singlePlaceholderArray]; } for (var i = 0; i < singlePlaceholderArray.length; i += 1) { this._addPlaceholderDependencies(singlePlaceholderArray[i], dependencies, lazy); } } } return dependencies; }
[ "function", "(", "lazy", ")", "{", "var", "dependencies", "=", "{", "templates", ":", "[", "]", ",", "classes", ":", "[", "]", ",", "modules", ":", "{", "page", ":", "[", "]", ",", "common", ":", "[", "]", "}", ",", "css", ":", "[", "]", "}", ";", "var", "pageComposition", "=", "this", ".", "_pageConfig", ".", "pageComposition", ";", "var", "placeholders", "=", "pageComposition", ".", "placeholders", "||", "{", "}", ";", "var", "typeUtils", "=", "ariaUtilsType", ";", "if", "(", "!", "lazy", ")", "{", "this", ".", "_utils", ".", "addIfMissing", "(", "pageComposition", ".", "template", ",", "dependencies", ".", "templates", ")", ";", "if", "(", "pageComposition", ".", "css", ")", "{", "dependencies", ".", "css", "=", "pageComposition", ".", "css", ".", "slice", "(", "0", ")", ";", "}", "}", "for", "(", "var", "placeholderName", "in", "placeholders", ")", "{", "if", "(", "placeholders", ".", "hasOwnProperty", "(", "placeholderName", ")", ")", "{", "var", "singlePlaceholderArray", "=", "placeholders", "[", "placeholderName", "]", ";", "if", "(", "!", "typeUtils", ".", "isArray", "(", "singlePlaceholderArray", ")", ")", "{", "singlePlaceholderArray", "=", "[", "singlePlaceholderArray", "]", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "singlePlaceholderArray", ".", "length", ";", "i", "+=", "1", ")", "{", "this", ".", "_addPlaceholderDependencies", "(", "singlePlaceholderArray", "[", "i", "]", ",", "dependencies", ",", "lazy", ")", ";", "}", "}", "}", "return", "dependencies", ";", "}" ]
Extract the dependencies of a page. It'll go through all submodule and placeholders and return the list of classpaths to be loaded in the page @return {Object} It contains the properties:<br/> <ul> <li>templates : Array containing the classpaths of the templates to load</li> <li>classes : Array containing the classpaths of the module controllers to load</li> <li>modules : Object containing page-specific and common modules refpaths</li> </ul>
[ "Extract", "the", "dependencies", "of", "a", "page", ".", "It", "ll", "go", "through", "all", "submodule", "and", "placeholders", "and", "return", "the", "list", "of", "classpaths", "to", "be", "loaded", "in", "the", "page" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/PageConfigHelper.js#L73-L108
27,372
ariatemplates/ariatemplates
src/aria/pageEngine/utils/PageConfigHelper.js
function (placeholder, dependencies, lazy) { var modules = this._pageModules, refpath, moduleDesc, typeUtils = ariaUtilsType; if (!typeUtils.isObject(placeholder)) { return; } var isLazy = (placeholder.lazy); if ((lazy && !isLazy) || (!lazy && isLazy)) { return; } if ("module" in placeholder) { refpath = placeholder.module; if (refpath.match(/^common:/)) { this._utils.addIfMissing(refpath.replace(/^common:/, ""), dependencies.modules.common); } else { moduleDesc = modules[refpath]; if (moduleDesc) { this._utils.addIfMissing(moduleDesc.classpath, dependencies.classes); this._utils.addIfMissing(refpath, dependencies.modules.page); } } } if ("template" in placeholder) { this._utils.addIfMissing(placeholder.template, dependencies.templates); } if ("css" in placeholder) { this._utils.wiseConcat(dependencies.css, placeholder.css); } }
javascript
function (placeholder, dependencies, lazy) { var modules = this._pageModules, refpath, moduleDesc, typeUtils = ariaUtilsType; if (!typeUtils.isObject(placeholder)) { return; } var isLazy = (placeholder.lazy); if ((lazy && !isLazy) || (!lazy && isLazy)) { return; } if ("module" in placeholder) { refpath = placeholder.module; if (refpath.match(/^common:/)) { this._utils.addIfMissing(refpath.replace(/^common:/, ""), dependencies.modules.common); } else { moduleDesc = modules[refpath]; if (moduleDesc) { this._utils.addIfMissing(moduleDesc.classpath, dependencies.classes); this._utils.addIfMissing(refpath, dependencies.modules.page); } } } if ("template" in placeholder) { this._utils.addIfMissing(placeholder.template, dependencies.templates); } if ("css" in placeholder) { this._utils.wiseConcat(dependencies.css, placeholder.css); } }
[ "function", "(", "placeholder", ",", "dependencies", ",", "lazy", ")", "{", "var", "modules", "=", "this", ".", "_pageModules", ",", "refpath", ",", "moduleDesc", ",", "typeUtils", "=", "ariaUtilsType", ";", "if", "(", "!", "typeUtils", ".", "isObject", "(", "placeholder", ")", ")", "{", "return", ";", "}", "var", "isLazy", "=", "(", "placeholder", ".", "lazy", ")", ";", "if", "(", "(", "lazy", "&&", "!", "isLazy", ")", "||", "(", "!", "lazy", "&&", "isLazy", ")", ")", "{", "return", ";", "}", "if", "(", "\"module\"", "in", "placeholder", ")", "{", "refpath", "=", "placeholder", ".", "module", ";", "if", "(", "refpath", ".", "match", "(", "/", "^common:", "/", ")", ")", "{", "this", ".", "_utils", ".", "addIfMissing", "(", "refpath", ".", "replace", "(", "/", "^common:", "/", ",", "\"\"", ")", ",", "dependencies", ".", "modules", ".", "common", ")", ";", "}", "else", "{", "moduleDesc", "=", "modules", "[", "refpath", "]", ";", "if", "(", "moduleDesc", ")", "{", "this", ".", "_utils", ".", "addIfMissing", "(", "moduleDesc", ".", "classpath", ",", "dependencies", ".", "classes", ")", ";", "this", ".", "_utils", ".", "addIfMissing", "(", "refpath", ",", "dependencies", ".", "modules", ".", "page", ")", ";", "}", "}", "}", "if", "(", "\"template\"", "in", "placeholder", ")", "{", "this", ".", "_utils", ".", "addIfMissing", "(", "placeholder", ".", "template", ",", "dependencies", ".", "templates", ")", ";", "}", "if", "(", "\"css\"", "in", "placeholder", ")", "{", "this", ".", "_utils", ".", "wiseConcat", "(", "dependencies", ".", "css", ",", "placeholder", ".", "css", ")", ";", "}", "}" ]
Extract the dependencies from a placeholder definition and add them to dependencies argument @param {aria.pageEngine.CfgBeans:Placeholder} placeholder @param {Object} dependencies @private
[ "Extract", "the", "dependencies", "from", "a", "placeholder", "definition", "and", "add", "them", "to", "dependencies", "argument" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/PageConfigHelper.js#L116-L143
27,373
ariatemplates/ariatemplates
src/aria/pageEngine/utils/PageConfigHelper.js
function () { var output = [], isLazy, typeUtils = ariaUtilsType; var placeholders = this._pageConfig.pageComposition.placeholders || {}; for (var placeholderName in placeholders) { if (placeholders.hasOwnProperty(placeholderName)) { isLazy = false; var singlePlaceholderArray = placeholders[placeholderName]; if (!typeUtils.isArray(singlePlaceholderArray)) { singlePlaceholderArray = [singlePlaceholderArray]; } for (var i = 0; i < singlePlaceholderArray.length; i += 1) { if (singlePlaceholderArray[i].lazy) { isLazy = true; } } if (isLazy) { output.push(placeholderName); } } } return output; }
javascript
function () { var output = [], isLazy, typeUtils = ariaUtilsType; var placeholders = this._pageConfig.pageComposition.placeholders || {}; for (var placeholderName in placeholders) { if (placeholders.hasOwnProperty(placeholderName)) { isLazy = false; var singlePlaceholderArray = placeholders[placeholderName]; if (!typeUtils.isArray(singlePlaceholderArray)) { singlePlaceholderArray = [singlePlaceholderArray]; } for (var i = 0; i < singlePlaceholderArray.length; i += 1) { if (singlePlaceholderArray[i].lazy) { isLazy = true; } } if (isLazy) { output.push(placeholderName); } } } return output; }
[ "function", "(", ")", "{", "var", "output", "=", "[", "]", ",", "isLazy", ",", "typeUtils", "=", "ariaUtilsType", ";", "var", "placeholders", "=", "this", ".", "_pageConfig", ".", "pageComposition", ".", "placeholders", "||", "{", "}", ";", "for", "(", "var", "placeholderName", "in", "placeholders", ")", "{", "if", "(", "placeholders", ".", "hasOwnProperty", "(", "placeholderName", ")", ")", "{", "isLazy", "=", "false", ";", "var", "singlePlaceholderArray", "=", "placeholders", "[", "placeholderName", "]", ";", "if", "(", "!", "typeUtils", ".", "isArray", "(", "singlePlaceholderArray", ")", ")", "{", "singlePlaceholderArray", "=", "[", "singlePlaceholderArray", "]", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "singlePlaceholderArray", ".", "length", ";", "i", "+=", "1", ")", "{", "if", "(", "singlePlaceholderArray", "[", "i", "]", ".", "lazy", ")", "{", "isLazy", "=", "true", ";", "}", "}", "if", "(", "isLazy", ")", "{", "output", ".", "push", "(", "placeholderName", ")", ";", "}", "}", "}", "return", "output", ";", "}" ]
Compute the id of the placeholders who have at least on lazy content @return {Array} ids of the lazy placeholders.
[ "Compute", "the", "id", "of", "the", "placeholders", "who", "have", "at", "least", "on", "lazy", "content" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/pageEngine/utils/PageConfigHelper.js#L168-L191
27,374
ariatemplates/ariatemplates
build/grunt-tasks/task-removedirs.js
rmDirRecursive
function rmDirRecursive(dirPath) { if(!fs.existsSync(dirPath)){ grunt.log.write('Directory ' + dirPath + ' does not exist. '); return 0; // fine } var files; try { files = fs.readdirSync(dirPath); } catch(e) { grunt.fatal('Exception when trying to remove folder ' + dirPath); grunt.log.writeln(e); } var count = 0; if (files.length > 0) { for (var i = 0; i < files.length; i++) { var filePath = dirPath + '/' + files[i]; if (fs.statSync(filePath).isFile()) { fs.unlinkSync(filePath); } else { count += rmDirRecursive(filePath); } } } fs.rmdirSync(dirPath); count += files.length + 1; return count; }
javascript
function rmDirRecursive(dirPath) { if(!fs.existsSync(dirPath)){ grunt.log.write('Directory ' + dirPath + ' does not exist. '); return 0; // fine } var files; try { files = fs.readdirSync(dirPath); } catch(e) { grunt.fatal('Exception when trying to remove folder ' + dirPath); grunt.log.writeln(e); } var count = 0; if (files.length > 0) { for (var i = 0; i < files.length; i++) { var filePath = dirPath + '/' + files[i]; if (fs.statSync(filePath).isFile()) { fs.unlinkSync(filePath); } else { count += rmDirRecursive(filePath); } } } fs.rmdirSync(dirPath); count += files.length + 1; return count; }
[ "function", "rmDirRecursive", "(", "dirPath", ")", "{", "if", "(", "!", "fs", ".", "existsSync", "(", "dirPath", ")", ")", "{", "grunt", ".", "log", ".", "write", "(", "'Directory '", "+", "dirPath", "+", "' does not exist. '", ")", ";", "return", "0", ";", "// fine", "}", "var", "files", ";", "try", "{", "files", "=", "fs", ".", "readdirSync", "(", "dirPath", ")", ";", "}", "catch", "(", "e", ")", "{", "grunt", ".", "fatal", "(", "'Exception when trying to remove folder '", "+", "dirPath", ")", ";", "grunt", ".", "log", ".", "writeln", "(", "e", ")", ";", "}", "var", "count", "=", "0", ";", "if", "(", "files", ".", "length", ">", "0", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "i", "++", ")", "{", "var", "filePath", "=", "dirPath", "+", "'/'", "+", "files", "[", "i", "]", ";", "if", "(", "fs", ".", "statSync", "(", "filePath", ")", ".", "isFile", "(", ")", ")", "{", "fs", ".", "unlinkSync", "(", "filePath", ")", ";", "}", "else", "{", "count", "+=", "rmDirRecursive", "(", "filePath", ")", ";", "}", "}", "}", "fs", ".", "rmdirSync", "(", "dirPath", ")", ";", "count", "+=", "files", ".", "length", "+", "1", ";", "return", "count", ";", "}" ]
Remove directory recursively, if it exists. @param dirPath {String} directory to be removed. @return {Number} no. of files/directories removed
[ "Remove", "directory", "recursively", "if", "it", "exists", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/build/grunt-tasks/task-removedirs.js#L29-L57
27,375
ariatemplates/ariatemplates
src/aria/widgets/TemplateBasedWidget.js
function (tplCfg) { if (this._cfgOk) { var cfg = this._cfg; for (var i = 0, len = this.__inherithCfg.length; i < len; i += 1) { var property = this.__inherithCfg[i]; if (!tplCfg.hasOwnProperty(property)) { tplCfg[property] = cfg[property]; } } if (cfg.defaultTemplate) { // allow the customization of the template: tplCfg.defaultTemplate = cfg.defaultTemplate; } if (cfg.id) { tplCfg.id = cfg.id + "_t_"; } var tplWidget = this._tplWidget = new ariaWidgetsTemplate(tplCfg, this._context, this._lineNumber); var extraAttributes = this._extraAttributes; if (extraAttributes) { tplWidget.addExtraAttributes(extraAttributes); } tplWidget.tplLoadCallback = { fn : this._tplLoadCallback, scope : this }; } }
javascript
function (tplCfg) { if (this._cfgOk) { var cfg = this._cfg; for (var i = 0, len = this.__inherithCfg.length; i < len; i += 1) { var property = this.__inherithCfg[i]; if (!tplCfg.hasOwnProperty(property)) { tplCfg[property] = cfg[property]; } } if (cfg.defaultTemplate) { // allow the customization of the template: tplCfg.defaultTemplate = cfg.defaultTemplate; } if (cfg.id) { tplCfg.id = cfg.id + "_t_"; } var tplWidget = this._tplWidget = new ariaWidgetsTemplate(tplCfg, this._context, this._lineNumber); var extraAttributes = this._extraAttributes; if (extraAttributes) { tplWidget.addExtraAttributes(extraAttributes); } tplWidget.tplLoadCallback = { fn : this._tplLoadCallback, scope : this }; } }
[ "function", "(", "tplCfg", ")", "{", "if", "(", "this", ".", "_cfgOk", ")", "{", "var", "cfg", "=", "this", ".", "_cfg", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "this", ".", "__inherithCfg", ".", "length", ";", "i", "<", "len", ";", "i", "+=", "1", ")", "{", "var", "property", "=", "this", ".", "__inherithCfg", "[", "i", "]", ";", "if", "(", "!", "tplCfg", ".", "hasOwnProperty", "(", "property", ")", ")", "{", "tplCfg", "[", "property", "]", "=", "cfg", "[", "property", "]", ";", "}", "}", "if", "(", "cfg", ".", "defaultTemplate", ")", "{", "// allow the customization of the template:", "tplCfg", ".", "defaultTemplate", "=", "cfg", ".", "defaultTemplate", ";", "}", "if", "(", "cfg", ".", "id", ")", "{", "tplCfg", ".", "id", "=", "cfg", ".", "id", "+", "\"_t_\"", ";", "}", "var", "tplWidget", "=", "this", ".", "_tplWidget", "=", "new", "ariaWidgetsTemplate", "(", "tplCfg", ",", "this", ".", "_context", ",", "this", ".", "_lineNumber", ")", ";", "var", "extraAttributes", "=", "this", ".", "_extraAttributes", ";", "if", "(", "extraAttributes", ")", "{", "tplWidget", ".", "addExtraAttributes", "(", "extraAttributes", ")", ";", "}", "tplWidget", ".", "tplLoadCallback", "=", "{", "fn", ":", "this", ".", "_tplLoadCallback", ",", "scope", ":", "this", "}", ";", "}", "}" ]
Initialize the template associated to this template based widget. It will create a new instance of the Template. @param {aria.templates.CfgBeans:LoadTemplateCfg} tplCfg Template configuration object @protected
[ "Initialize", "the", "template", "associated", "to", "this", "template", "based", "widget", ".", "It", "will", "create", "a", "new", "instance", "of", "the", "Template", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/TemplateBasedWidget.js#L58-L87
27,376
ariatemplates/ariatemplates
src/aria/widgets/TemplateBasedWidget.js
function (args) { if (args.success) { this._subTplCtxt = args.templateCtxt; this._subTplModuleCtrl = args.templateCtxt.moduleCtrl; this._subTplData = this._subTplCtxt.data; if (this._subTplModuleCtrl) { this._subTplModuleCtrl.$on({ '*' : this._onModuleEvent, scope : this }); } // only register the bindings here, when the widget template is totally loaded this._registerBindings(); // binding registering may refresh the page if (this._tplWidget) { this.initWidgetDom(this._tplWidget.getDom()); this.$raiseEvent("widgetContentReady"); } } // TODO: if not args.success, need to log something ? }
javascript
function (args) { if (args.success) { this._subTplCtxt = args.templateCtxt; this._subTplModuleCtrl = args.templateCtxt.moduleCtrl; this._subTplData = this._subTplCtxt.data; if (this._subTplModuleCtrl) { this._subTplModuleCtrl.$on({ '*' : this._onModuleEvent, scope : this }); } // only register the bindings here, when the widget template is totally loaded this._registerBindings(); // binding registering may refresh the page if (this._tplWidget) { this.initWidgetDom(this._tplWidget.getDom()); this.$raiseEvent("widgetContentReady"); } } // TODO: if not args.success, need to log something ? }
[ "function", "(", "args", ")", "{", "if", "(", "args", ".", "success", ")", "{", "this", ".", "_subTplCtxt", "=", "args", ".", "templateCtxt", ";", "this", ".", "_subTplModuleCtrl", "=", "args", ".", "templateCtxt", ".", "moduleCtrl", ";", "this", ".", "_subTplData", "=", "this", ".", "_subTplCtxt", ".", "data", ";", "if", "(", "this", ".", "_subTplModuleCtrl", ")", "{", "this", ".", "_subTplModuleCtrl", ".", "$on", "(", "{", "'*'", ":", "this", ".", "_onModuleEvent", ",", "scope", ":", "this", "}", ")", ";", "}", "// only register the bindings here, when the widget template is totally loaded", "this", ".", "_registerBindings", "(", ")", ";", "// binding registering may refresh the page", "if", "(", "this", ".", "_tplWidget", ")", "{", "this", ".", "initWidgetDom", "(", "this", ".", "_tplWidget", ".", "getDom", "(", ")", ")", ";", "this", ".", "$raiseEvent", "(", "\"widgetContentReady\"", ")", ";", "}", "}", "// TODO: if not args.success, need to log something ?", "}" ]
Callback executed after the template is loaded and initialized. As this widget has _directInit it gets initialized soon after writing it to the DOM, however the callback can be executed after the first refresh if the template context is not available @param {Object} args Contains information about the load and instance of the template context @protected
[ "Callback", "executed", "after", "the", "template", "is", "loaded", "and", "initialized", ".", "As", "this", "widget", "has", "_directInit", "it", "gets", "initialized", "soon", "after", "writing", "it", "to", "the", "DOM", "however", "the", "callback", "can", "be", "executed", "after", "the", "first", "refresh", "if", "the", "template", "context", "is", "not", "available" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/TemplateBasedWidget.js#L105-L126
27,377
ariatemplates/ariatemplates
src/aria/widgets/TemplateBasedWidget.js
function (out) { if (!this._cfgOk) { return aria.widgets.TemplateBasedWidget.superclass.writeMarkup.call(this, out); } // Prepare delegation id before to have it linked with this widget this._tplWidget._delegateId = aria.utils.Delegate.add({ fn : this.delegate, scope : this }); this._tplWidget.writeMarkup(out); this._domReady = true; }
javascript
function (out) { if (!this._cfgOk) { return aria.widgets.TemplateBasedWidget.superclass.writeMarkup.call(this, out); } // Prepare delegation id before to have it linked with this widget this._tplWidget._delegateId = aria.utils.Delegate.add({ fn : this.delegate, scope : this }); this._tplWidget.writeMarkup(out); this._domReady = true; }
[ "function", "(", "out", ")", "{", "if", "(", "!", "this", ".", "_cfgOk", ")", "{", "return", "aria", ".", "widgets", ".", "TemplateBasedWidget", ".", "superclass", ".", "writeMarkup", ".", "call", "(", "this", ",", "out", ")", ";", "}", "// Prepare delegation id before to have it linked with this widget", "this", ".", "_tplWidget", ".", "_delegateId", "=", "aria", ".", "utils", ".", "Delegate", ".", "add", "(", "{", "fn", ":", "this", ".", "delegate", ",", "scope", ":", "this", "}", ")", ";", "this", ".", "_tplWidget", ".", "writeMarkup", "(", "out", ")", ";", "this", ".", "_domReady", "=", "true", ";", "}" ]
Write the widget markup into the Markup Writer @param {aria.templates.MarkupWriter} out Markup Writer
[ "Write", "the", "widget", "markup", "into", "the", "Markup", "Writer" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/widgets/TemplateBasedWidget.js#L132-L146
27,378
ariatemplates/ariatemplates
src/aria/storage/UserData.js
setMappedKey
function setMappedKey (generated, original) { if (generated) { allKeyMap[original] = generated; } else { delete allKeyMap[original]; } storage.setAttribute("kMap", privateSerializer.serialize(allKeyMap)); storage.save("JSONPersist"); }
javascript
function setMappedKey (generated, original) { if (generated) { allKeyMap[original] = generated; } else { delete allKeyMap[original]; } storage.setAttribute("kMap", privateSerializer.serialize(allKeyMap)); storage.save("JSONPersist"); }
[ "function", "setMappedKey", "(", "generated", ",", "original", ")", "{", "if", "(", "generated", ")", "{", "allKeyMap", "[", "original", "]", "=", "generated", ";", "}", "else", "{", "delete", "allKeyMap", "[", "original", "]", ";", "}", "storage", ".", "setAttribute", "(", "\"kMap\"", ",", "privateSerializer", ".", "serialize", "(", "allKeyMap", ")", ")", ";", "storage", ".", "save", "(", "\"JSONPersist\"", ")", ";", "}" ]
Store the newly generated key in the map of keys @type {String} generated Key generated by the framework, safe to be used with setAttribute. If null, removes the original key from the map @type {String} original User defined key, it might contain unsafe characters
[ "Store", "the", "newly", "generated", "key", "in", "the", "map", "of", "keys" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/storage/UserData.js#L49-L58
27,379
ariatemplates/ariatemplates
src/aria/storage/UserData.js
getMappedKey
function getMappedKey (key, create) { allKeyMap = getAllKeys(); if (create && !(key in allKeyMap)) { var newKey = ("uD" + _UNIQUE_ID++); setMappedKey(newKey, key); return newKey; } else { return allKeyMap[key]; } }
javascript
function getMappedKey (key, create) { allKeyMap = getAllKeys(); if (create && !(key in allKeyMap)) { var newKey = ("uD" + _UNIQUE_ID++); setMappedKey(newKey, key); return newKey; } else { return allKeyMap[key]; } }
[ "function", "getMappedKey", "(", "key", ",", "create", ")", "{", "allKeyMap", "=", "getAllKeys", "(", ")", ";", "if", "(", "create", "&&", "!", "(", "key", "in", "allKeyMap", ")", ")", "{", "var", "newKey", "=", "(", "\"uD\"", "+", "_UNIQUE_ID", "++", ")", ";", "setMappedKey", "(", "newKey", ",", "key", ")", ";", "return", "newKey", ";", "}", "else", "{", "return", "allKeyMap", "[", "key", "]", ";", "}", "}" ]
Return the generated key corresponding to the user defined key, and optionally creates one if missing. @param {String} key User defined key @param {Boolean} create create it if missing, default false @return {String} framework generated key
[ "Return", "the", "generated", "key", "corresponding", "to", "the", "user", "defined", "key", "and", "optionally", "creates", "one", "if", "missing", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/storage/UserData.js#L66-L77
27,380
ariatemplates/ariatemplates
src/aria/storage/UserData.js
function (key) { storage.removeAttribute(getMappedKey(key)); setMappedKey(null, key); storage.save("JSONPersist"); }
javascript
function (key) { storage.removeAttribute(getMappedKey(key)); setMappedKey(null, key); storage.save("JSONPersist"); }
[ "function", "(", "key", ")", "{", "storage", ".", "removeAttribute", "(", "getMappedKey", "(", "key", ")", ")", ";", "setMappedKey", "(", "null", ",", "key", ")", ";", "storage", ".", "save", "(", "\"JSONPersist\"", ")", ";", "}" ]
Internal method to remove the value associated to key from the list. @param {String} key identifier of the value to be removed
[ "Internal", "method", "to", "remove", "the", "value", "associated", "to", "key", "from", "the", "list", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/storage/UserData.js#L148-L152
27,381
ariatemplates/ariatemplates
src/aria/utils/validators/MultipleValidator.js
function (value, groups, event) { var validators = this.validators; if (validators.length) { var res; var isMember = false; for (var i = 0; i < validators.length; i++) { isMember = this.dataUtils.checkGroup(validators[i].groups, groups); if (isMember && (this.dataUtils.checkEventToValidate(validators[i].eventToValidate, event))) { var extraRes = validators[i].validate(value, groups, event); if (extraRes && extraRes.length > 0) { if (res == null) { res = extraRes; } else { res = res.concat(extraRes); } if (this.breakOnMessage) { break; } } } } if (res && res.length > 0) { if (this.groupMessages) { var msgGroup = ariaUtilsJson.copy(this.message); msgGroup.subMessages = res; return [msgGroup]; } else { return res; } } return null; } }
javascript
function (value, groups, event) { var validators = this.validators; if (validators.length) { var res; var isMember = false; for (var i = 0; i < validators.length; i++) { isMember = this.dataUtils.checkGroup(validators[i].groups, groups); if (isMember && (this.dataUtils.checkEventToValidate(validators[i].eventToValidate, event))) { var extraRes = validators[i].validate(value, groups, event); if (extraRes && extraRes.length > 0) { if (res == null) { res = extraRes; } else { res = res.concat(extraRes); } if (this.breakOnMessage) { break; } } } } if (res && res.length > 0) { if (this.groupMessages) { var msgGroup = ariaUtilsJson.copy(this.message); msgGroup.subMessages = res; return [msgGroup]; } else { return res; } } return null; } }
[ "function", "(", "value", ",", "groups", ",", "event", ")", "{", "var", "validators", "=", "this", ".", "validators", ";", "if", "(", "validators", ".", "length", ")", "{", "var", "res", ";", "var", "isMember", "=", "false", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "validators", ".", "length", ";", "i", "++", ")", "{", "isMember", "=", "this", ".", "dataUtils", ".", "checkGroup", "(", "validators", "[", "i", "]", ".", "groups", ",", "groups", ")", ";", "if", "(", "isMember", "&&", "(", "this", ".", "dataUtils", ".", "checkEventToValidate", "(", "validators", "[", "i", "]", ".", "eventToValidate", ",", "event", ")", ")", ")", "{", "var", "extraRes", "=", "validators", "[", "i", "]", ".", "validate", "(", "value", ",", "groups", ",", "event", ")", ";", "if", "(", "extraRes", "&&", "extraRes", ".", "length", ">", "0", ")", "{", "if", "(", "res", "==", "null", ")", "{", "res", "=", "extraRes", ";", "}", "else", "{", "res", "=", "res", ".", "concat", "(", "extraRes", ")", ";", "}", "if", "(", "this", ".", "breakOnMessage", ")", "{", "break", ";", "}", "}", "}", "}", "if", "(", "res", "&&", "res", ".", "length", ">", "0", ")", "{", "if", "(", "this", ".", "groupMessages", ")", "{", "var", "msgGroup", "=", "ariaUtilsJson", ".", "copy", "(", "this", ".", "message", ")", ";", "msgGroup", ".", "subMessages", "=", "res", ";", "return", "[", "msgGroup", "]", ";", "}", "else", "{", "return", "res", ";", "}", "}", "return", "null", ";", "}", "}" ]
loops through each validator within the multiple validator and calls it's validate method. @param {String} value to be validated. @param {Array} groups to validate against. @param {String} event that validation occurs on. @return {Object} res containing any message objects if validation fails.
[ "loops", "through", "each", "validator", "within", "the", "multiple", "validator", "and", "calls", "it", "s", "validate", "method", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/utils/validators/MultipleValidator.js#L51-L83
27,382
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (name, value) { if (value == null) { // null or undefined return this.removeParam(name); } if (this._params == null) { this._params = []; } for (var i = 0, length = this._params.length; i < length; i++) { var elt = this._params[i]; if (elt.name === name) { elt.value = encodeURIComponent(value); return; } } this._params.push({ name : name, value : encodeURIComponent(value) }); }
javascript
function (name, value) { if (value == null) { // null or undefined return this.removeParam(name); } if (this._params == null) { this._params = []; } for (var i = 0, length = this._params.length; i < length; i++) { var elt = this._params[i]; if (elt.name === name) { elt.value = encodeURIComponent(value); return; } } this._params.push({ name : name, value : encodeURIComponent(value) }); }
[ "function", "(", "name", ",", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "// null or undefined", "return", "this", ".", "removeParam", "(", "name", ")", ";", "}", "if", "(", "this", ".", "_params", "==", "null", ")", "{", "this", ".", "_params", "=", "[", "]", ";", "}", "for", "(", "var", "i", "=", "0", ",", "length", "=", "this", ".", "_params", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "var", "elt", "=", "this", ".", "_params", "[", "i", "]", ";", "if", "(", "elt", ".", "name", "===", "name", ")", "{", "elt", ".", "value", "=", "encodeURIComponent", "(", "value", ")", ";", "return", ";", "}", "}", "this", ".", "_params", ".", "push", "(", "{", "name", ":", "name", ",", "value", ":", "encodeURIComponent", "(", "value", ")", "}", ")", ";", "}" ]
Add a global request parameter that will be sent with each request, or update it if it already exists @param {String} name the parameter name @param {String} value the parameter value
[ "Add", "a", "global", "request", "parameter", "that", "will", "be", "sent", "with", "each", "request", "or", "update", "it", "if", "it", "already", "exists" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L175-L193
27,383
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (name) { if (name == null || this._params == null) { return null; } for (var i = 0, length = this._params.length; i < length; i++) { var elt = this._params[i]; if (elt.name === name) { return elt.value; } } return null; }
javascript
function (name) { if (name == null || this._params == null) { return null; } for (var i = 0, length = this._params.length; i < length; i++) { var elt = this._params[i]; if (elt.name === name) { return elt.value; } } return null; }
[ "function", "(", "name", ")", "{", "if", "(", "name", "==", "null", "||", "this", ".", "_params", "==", "null", ")", "{", "return", "null", ";", "}", "for", "(", "var", "i", "=", "0", ",", "length", "=", "this", ".", "_params", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "var", "elt", "=", "this", ".", "_params", "[", "i", "]", ";", "if", "(", "elt", ".", "name", "===", "name", ")", "{", "return", "elt", ".", "value", ";", "}", "}", "return", "null", ";", "}" ]
Get global request parameters that match the given name. @param {String} name the parameter name to get
[ "Get", "global", "request", "parameters", "that", "match", "the", "given", "name", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L199-L210
27,384
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (name) { if (name == null) { this._params = null; } if (this._params == null) { return; } for (var i = 0, length = this._params.length; i < length; i++) { var elt = this._params[i]; if (elt.name === name) { this._params.splice(i, 1); length--; } } }
javascript
function (name) { if (name == null) { this._params = null; } if (this._params == null) { return; } for (var i = 0, length = this._params.length; i < length; i++) { var elt = this._params[i]; if (elt.name === name) { this._params.splice(i, 1); length--; } } }
[ "function", "(", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "this", ".", "_params", "=", "null", ";", "}", "if", "(", "this", ".", "_params", "==", "null", ")", "{", "return", ";", "}", "for", "(", "var", "i", "=", "0", ",", "length", "=", "this", ".", "_params", ".", "length", ";", "i", "<", "length", ";", "i", "++", ")", "{", "var", "elt", "=", "this", ".", "_params", "[", "i", "]", ";", "if", "(", "elt", ".", "name", "===", "name", ")", "{", "this", ".", "_params", ".", "splice", "(", "i", ",", "1", ")", ";", "length", "--", ";", "}", "}", "}" ]
Remove global request parameters that match the given name. @param {String} name the parameter name to remove. If omitted, remove all params.
[ "Remove", "global", "request", "parameters", "that", "match", "the", "given", "name", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L216-L230
27,385
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (args) { var req = args.req; var handler = args.requestHandler; if (handler == null) { handler = this.__getRequestHandler(); } req.data = (req.data == null && req.method == "POST") ? handler.prepareRequestBody(req.jsonData, req.requestObject) : req.data; req.headers = handler.getRequestHeaders(); if (req.requestObject.headers) { req.headers = ariaUtilsJson.copy(req.headers, false); ariaUtilsJson.inject(req.requestObject.headers, req.headers, false); } // call the server var senderObject = { classpath : this.$classpath, requestObject : req.requestObject, requestData : req.jsonData, // the following two properties can be used to communicate from the filters to the RequestMgr and bypass // the handler: responseData : null, responseErrorData : null }; var requestObject = { sender : senderObject, url : req.url, async : (req.requestObject.async !== false), method : req.method, data : req.data, headers : req.headers, timeout : req.timeout, callback : { fn : this._onresponse, onerror : this._onresponse, scope : this, args : { requestObject : req.requestObject, senderObject : senderObject, cb : args.cb, id : args.id, session : args.session, actionQueuing : args.actionQueuing, requestHandler : handler } } }; if (handler.expectedResponseType) { requestObject.expectedResponseType = handler.expectedResponseType; } ariaCoreIO.asyncRequest(requestObject); }
javascript
function (args) { var req = args.req; var handler = args.requestHandler; if (handler == null) { handler = this.__getRequestHandler(); } req.data = (req.data == null && req.method == "POST") ? handler.prepareRequestBody(req.jsonData, req.requestObject) : req.data; req.headers = handler.getRequestHeaders(); if (req.requestObject.headers) { req.headers = ariaUtilsJson.copy(req.headers, false); ariaUtilsJson.inject(req.requestObject.headers, req.headers, false); } // call the server var senderObject = { classpath : this.$classpath, requestObject : req.requestObject, requestData : req.jsonData, // the following two properties can be used to communicate from the filters to the RequestMgr and bypass // the handler: responseData : null, responseErrorData : null }; var requestObject = { sender : senderObject, url : req.url, async : (req.requestObject.async !== false), method : req.method, data : req.data, headers : req.headers, timeout : req.timeout, callback : { fn : this._onresponse, onerror : this._onresponse, scope : this, args : { requestObject : req.requestObject, senderObject : senderObject, cb : args.cb, id : args.id, session : args.session, actionQueuing : args.actionQueuing, requestHandler : handler } } }; if (handler.expectedResponseType) { requestObject.expectedResponseType = handler.expectedResponseType; } ariaCoreIO.asyncRequest(requestObject); }
[ "function", "(", "args", ")", "{", "var", "req", "=", "args", ".", "req", ";", "var", "handler", "=", "args", ".", "requestHandler", ";", "if", "(", "handler", "==", "null", ")", "{", "handler", "=", "this", ".", "__getRequestHandler", "(", ")", ";", "}", "req", ".", "data", "=", "(", "req", ".", "data", "==", "null", "&&", "req", ".", "method", "==", "\"POST\"", ")", "?", "handler", ".", "prepareRequestBody", "(", "req", ".", "jsonData", ",", "req", ".", "requestObject", ")", ":", "req", ".", "data", ";", "req", ".", "headers", "=", "handler", ".", "getRequestHeaders", "(", ")", ";", "if", "(", "req", ".", "requestObject", ".", "headers", ")", "{", "req", ".", "headers", "=", "ariaUtilsJson", ".", "copy", "(", "req", ".", "headers", ",", "false", ")", ";", "ariaUtilsJson", ".", "inject", "(", "req", ".", "requestObject", ".", "headers", ",", "req", ".", "headers", ",", "false", ")", ";", "}", "// call the server", "var", "senderObject", "=", "{", "classpath", ":", "this", ".", "$classpath", ",", "requestObject", ":", "req", ".", "requestObject", ",", "requestData", ":", "req", ".", "jsonData", ",", "// the following two properties can be used to communicate from the filters to the RequestMgr and bypass", "// the handler:", "responseData", ":", "null", ",", "responseErrorData", ":", "null", "}", ";", "var", "requestObject", "=", "{", "sender", ":", "senderObject", ",", "url", ":", "req", ".", "url", ",", "async", ":", "(", "req", ".", "requestObject", ".", "async", "!==", "false", ")", ",", "method", ":", "req", ".", "method", ",", "data", ":", "req", ".", "data", ",", "headers", ":", "req", ".", "headers", ",", "timeout", ":", "req", ".", "timeout", ",", "callback", ":", "{", "fn", ":", "this", ".", "_onresponse", ",", "onerror", ":", "this", ".", "_onresponse", ",", "scope", ":", "this", ",", "args", ":", "{", "requestObject", ":", "req", ".", "requestObject", ",", "senderObject", ":", "senderObject", ",", "cb", ":", "args", ".", "cb", ",", "id", ":", "args", ".", "id", ",", "session", ":", "args", ".", "session", ",", "actionQueuing", ":", "args", ".", "actionQueuing", ",", "requestHandler", ":", "handler", "}", "}", "}", ";", "if", "(", "handler", ".", "expectedResponseType", ")", "{", "requestObject", ".", "expectedResponseType", "=", "handler", ".", "expectedResponseType", ";", "}", "ariaCoreIO", ".", "asyncRequest", "(", "requestObject", ")", ";", "}" ]
Continue request after request delay. @param {Object} args contains req, cb, actionqueuing, session @protected
[ "Continue", "request", "after", "request", "delay", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L371-L426
27,386
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (args) { // var cb = args.cb; var res = args.res; var handler = args.requestHandler; // http error > use process failure if (res.error) { handler.processFailure({ error : res.error, status : res.status, responseXML : res.responseXML, responseText : res.responseText, responseJSON : res.responseJSON }, { url : args.res.url, session : args.session, requestObject : args.requestObject }, { fn : this._callRequestCallback, scope : this, args : args }); } else { handler.processSuccess({ responseXML : res.responseXML, responseText : res.responseText, responseJSON : res.responseJSON }, { url : res.url, session : args.session, requestObject : args.requestObject }, { fn : this._callRequestCallback, scope : this, args : args }); } }
javascript
function (args) { // var cb = args.cb; var res = args.res; var handler = args.requestHandler; // http error > use process failure if (res.error) { handler.processFailure({ error : res.error, status : res.status, responseXML : res.responseXML, responseText : res.responseText, responseJSON : res.responseJSON }, { url : args.res.url, session : args.session, requestObject : args.requestObject }, { fn : this._callRequestCallback, scope : this, args : args }); } else { handler.processSuccess({ responseXML : res.responseXML, responseText : res.responseText, responseJSON : res.responseJSON }, { url : res.url, session : args.session, requestObject : args.requestObject }, { fn : this._callRequestCallback, scope : this, args : args }); } }
[ "function", "(", "args", ")", "{", "// var cb = args.cb;", "var", "res", "=", "args", ".", "res", ";", "var", "handler", "=", "args", ".", "requestHandler", ";", "// http error > use process failure", "if", "(", "res", ".", "error", ")", "{", "handler", ".", "processFailure", "(", "{", "error", ":", "res", ".", "error", ",", "status", ":", "res", ".", "status", ",", "responseXML", ":", "res", ".", "responseXML", ",", "responseText", ":", "res", ".", "responseText", ",", "responseJSON", ":", "res", ".", "responseJSON", "}", ",", "{", "url", ":", "args", ".", "res", ".", "url", ",", "session", ":", "args", ".", "session", ",", "requestObject", ":", "args", ".", "requestObject", "}", ",", "{", "fn", ":", "this", ".", "_callRequestCallback", ",", "scope", ":", "this", ",", "args", ":", "args", "}", ")", ";", "}", "else", "{", "handler", ".", "processSuccess", "(", "{", "responseXML", ":", "res", ".", "responseXML", ",", "responseText", ":", "res", ".", "responseText", ",", "responseJSON", ":", "res", ".", "responseJSON", "}", ",", "{", "url", ":", "res", ".", "url", ",", "session", ":", "args", ".", "session", ",", "requestObject", ":", "args", ".", "requestObject", "}", ",", "{", "fn", ":", "this", ".", "_callRequestCallback", ",", "scope", ":", "this", ",", "args", ":", "args", "}", ")", ";", "}", "}" ]
After delay, use handler to parse the message. @param {Object} args contains path, cb, actionqueuing, session, filterRes, res and potential httpError @protected
[ "After", "delay", "use", "handler", "to", "parse", "the", "message", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L471-L509
27,387
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (res, args) { var resFromFilters = args.res; // set final error flag if (resFromFilters.errorData) { res.error = true; } // resFromFilters as precedence over handler response if (resFromFilters.data) { res.data = resFromFilters.data; } if (resFromFilters.errorData) { res.errorData = resFromFilters.errorData; } if (res.error) { var errorEvt = { name : "error", requestUrl : resFromFilters.requestUrl, requestObject : args.requestObject, errorData : res.errorData }; // add HTTP errors if any if (resFromFilters.error) { errorEvt.httpError = { error : resFromFilters.error, status : resFromFilters.status }; } this.$raiseEvent(errorEvt); } // finish by calling the requester callback this.$callback(args.cb, res, this.CALLBACK_ERROR); }
javascript
function (res, args) { var resFromFilters = args.res; // set final error flag if (resFromFilters.errorData) { res.error = true; } // resFromFilters as precedence over handler response if (resFromFilters.data) { res.data = resFromFilters.data; } if (resFromFilters.errorData) { res.errorData = resFromFilters.errorData; } if (res.error) { var errorEvt = { name : "error", requestUrl : resFromFilters.requestUrl, requestObject : args.requestObject, errorData : res.errorData }; // add HTTP errors if any if (resFromFilters.error) { errorEvt.httpError = { error : resFromFilters.error, status : resFromFilters.status }; } this.$raiseEvent(errorEvt); } // finish by calling the requester callback this.$callback(args.cb, res, this.CALLBACK_ERROR); }
[ "function", "(", "res", ",", "args", ")", "{", "var", "resFromFilters", "=", "args", ".", "res", ";", "// set final error flag", "if", "(", "resFromFilters", ".", "errorData", ")", "{", "res", ".", "error", "=", "true", ";", "}", "// resFromFilters as precedence over handler response", "if", "(", "resFromFilters", ".", "data", ")", "{", "res", ".", "data", "=", "resFromFilters", ".", "data", ";", "}", "if", "(", "resFromFilters", ".", "errorData", ")", "{", "res", ".", "errorData", "=", "resFromFilters", ".", "errorData", ";", "}", "if", "(", "res", ".", "error", ")", "{", "var", "errorEvt", "=", "{", "name", ":", "\"error\"", ",", "requestUrl", ":", "resFromFilters", ".", "requestUrl", ",", "requestObject", ":", "args", ".", "requestObject", ",", "errorData", ":", "res", ".", "errorData", "}", ";", "// add HTTP errors if any", "if", "(", "resFromFilters", ".", "error", ")", "{", "errorEvt", ".", "httpError", "=", "{", "error", ":", "resFromFilters", ".", "error", ",", "status", ":", "resFromFilters", ".", "status", "}", ";", "}", "this", ".", "$raiseEvent", "(", "errorEvt", ")", ";", "}", "// finish by calling the requester callback", "this", ".", "$callback", "(", "args", ".", "cb", ",", "res", ",", "this", ".", "CALLBACK_ERROR", ")", ";", "}" ]
After handler processing, raise error event if needed and call the callback given when the request was issued @protected @param {aria.modules.RequestBeans:ProcessedResponse} res final resource for the user @param {Object} args
[ "After", "handler", "processing", "raise", "error", "event", "if", "needed", "and", "call", "the", "callback", "given", "when", "the", "request", "was", "issued" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L517-L555
27,388
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (requestObject, session) { var typeUtils = ariaUtilsType; var urlService = requestObject.urlService; if (!urlService) { // If no service is set , it takes from app environment urlService = this.__getUrlService(); } this.$assert(434, urlService != null); // If not specified the session is the one stored on this if (!session) { session = this.session; } // Replace dots by forward slashes in the moduleName passed to actual URL creator var moduleName = requestObject.moduleName.replace(/\./g, '\/'); var url; if (typeUtils.isString(requestObject.actionName)) { // We accept also empty strings. // If in 'action name' mode /* The actionName from the request object can contain url parameters, this has to handled separately and not * by the request interface. */ var actionSplit = this.__extractActionName(requestObject.actionName); // Let the implementation compute the URL url = urlService.createActionUrl(moduleName, actionSplit.name, session.id); } else if (requestObject.serviceSpec) { /* using the 'service specification' mode. No particular URL parameters handling * here, all is under UrlService responsibility */ url = urlService.createServiceUrl(moduleName, requestObject.serviceSpec, session.id); } else { // error : one of serviceSpec or actionName must be present this.$logError(this.MISSING_SERVICESPEC, [url]); return null; } if (!url || (typeUtils.isObject(url) && !url.url)) { this.$logError(this.INVALID_BASEURL, [url]); return null; } if (typeUtils.isString(url)) { // if raw string returned, convert it in structured request here url = { url : url }; } // if not specified, assume POST method (backward-compatibility) if (!url.method) { url.method = "POST"; } if (requestObject.actionName) { // If in 'action name' mode, add the action parameters url.url = this.__appendActionParameters(url.url, actionSplit.params); } // Add the global parameters url.url = this.__appendGlobalParams(url.url, this._params); return url; }
javascript
function (requestObject, session) { var typeUtils = ariaUtilsType; var urlService = requestObject.urlService; if (!urlService) { // If no service is set , it takes from app environment urlService = this.__getUrlService(); } this.$assert(434, urlService != null); // If not specified the session is the one stored on this if (!session) { session = this.session; } // Replace dots by forward slashes in the moduleName passed to actual URL creator var moduleName = requestObject.moduleName.replace(/\./g, '\/'); var url; if (typeUtils.isString(requestObject.actionName)) { // We accept also empty strings. // If in 'action name' mode /* The actionName from the request object can contain url parameters, this has to handled separately and not * by the request interface. */ var actionSplit = this.__extractActionName(requestObject.actionName); // Let the implementation compute the URL url = urlService.createActionUrl(moduleName, actionSplit.name, session.id); } else if (requestObject.serviceSpec) { /* using the 'service specification' mode. No particular URL parameters handling * here, all is under UrlService responsibility */ url = urlService.createServiceUrl(moduleName, requestObject.serviceSpec, session.id); } else { // error : one of serviceSpec or actionName must be present this.$logError(this.MISSING_SERVICESPEC, [url]); return null; } if (!url || (typeUtils.isObject(url) && !url.url)) { this.$logError(this.INVALID_BASEURL, [url]); return null; } if (typeUtils.isString(url)) { // if raw string returned, convert it in structured request here url = { url : url }; } // if not specified, assume POST method (backward-compatibility) if (!url.method) { url.method = "POST"; } if (requestObject.actionName) { // If in 'action name' mode, add the action parameters url.url = this.__appendActionParameters(url.url, actionSplit.params); } // Add the global parameters url.url = this.__appendGlobalParams(url.url, this._params); return url; }
[ "function", "(", "requestObject", ",", "session", ")", "{", "var", "typeUtils", "=", "ariaUtilsType", ";", "var", "urlService", "=", "requestObject", ".", "urlService", ";", "if", "(", "!", "urlService", ")", "{", "// If no service is set , it takes from app environment", "urlService", "=", "this", ".", "__getUrlService", "(", ")", ";", "}", "this", ".", "$assert", "(", "434", ",", "urlService", "!=", "null", ")", ";", "// If not specified the session is the one stored on this", "if", "(", "!", "session", ")", "{", "session", "=", "this", ".", "session", ";", "}", "// Replace dots by forward slashes in the moduleName passed to actual URL creator", "var", "moduleName", "=", "requestObject", ".", "moduleName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "'\\/'", ")", ";", "var", "url", ";", "if", "(", "typeUtils", ".", "isString", "(", "requestObject", ".", "actionName", ")", ")", "{", "// We accept also empty strings.", "// If in 'action name' mode", "/* The actionName from the request object can contain url parameters, this has to handled separately and not\n * by the request interface. */", "var", "actionSplit", "=", "this", ".", "__extractActionName", "(", "requestObject", ".", "actionName", ")", ";", "// Let the implementation compute the URL", "url", "=", "urlService", ".", "createActionUrl", "(", "moduleName", ",", "actionSplit", ".", "name", ",", "session", ".", "id", ")", ";", "}", "else", "if", "(", "requestObject", ".", "serviceSpec", ")", "{", "/* using the 'service specification' mode. No particular URL parameters handling\n * here, all is under UrlService responsibility */", "url", "=", "urlService", ".", "createServiceUrl", "(", "moduleName", ",", "requestObject", ".", "serviceSpec", ",", "session", ".", "id", ")", ";", "}", "else", "{", "// error : one of serviceSpec or actionName must be present", "this", ".", "$logError", "(", "this", ".", "MISSING_SERVICESPEC", ",", "[", "url", "]", ")", ";", "return", "null", ";", "}", "if", "(", "!", "url", "||", "(", "typeUtils", ".", "isObject", "(", "url", ")", "&&", "!", "url", ".", "url", ")", ")", "{", "this", ".", "$logError", "(", "this", ".", "INVALID_BASEURL", ",", "[", "url", "]", ")", ";", "return", "null", ";", "}", "if", "(", "typeUtils", ".", "isString", "(", "url", ")", ")", "{", "// if raw string returned, convert it in structured request here", "url", "=", "{", "url", ":", "url", "}", ";", "}", "// if not specified, assume POST method (backward-compatibility)", "if", "(", "!", "url", ".", "method", ")", "{", "url", ".", "method", "=", "\"POST\"", ";", "}", "if", "(", "requestObject", ".", "actionName", ")", "{", "// If in 'action name' mode, add the action parameters", "url", ".", "url", "=", "this", ".", "__appendActionParameters", "(", "url", ".", "url", ",", "actionSplit", ".", "params", ")", ";", "}", "// Add the global parameters", "url", ".", "url", "=", "this", ".", "__appendGlobalParams", "(", "url", ".", "url", ",", "this", ".", "_params", ")", ";", "return", "url", ";", "}" ]
Internal function used to build the request URL @param {Object} requestObject the request object - see. RequestObject bean @param {Object} session session corresponding to the request (paramName and id) @return {String} the url
[ "Internal", "function", "used", "to", "build", "the", "request", "URL" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L563-L626
27,389
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (moduleName, locale, callback) { var urlServiceCfg = ariaModulesUrlServiceEnvironmentUrlService.getUrlServiceCfg(); Aria.load({ classes : [urlServiceCfg.implementation], oncomplete : { fn : this.__onI18nReady, scope : this, args : { moduleName : moduleName, locale : locale, callback : callback } } }); }
javascript
function (moduleName, locale, callback) { var urlServiceCfg = ariaModulesUrlServiceEnvironmentUrlService.getUrlServiceCfg(); Aria.load({ classes : [urlServiceCfg.implementation], oncomplete : { fn : this.__onI18nReady, scope : this, args : { moduleName : moduleName, locale : locale, callback : callback } } }); }
[ "function", "(", "moduleName", ",", "locale", ",", "callback", ")", "{", "var", "urlServiceCfg", "=", "ariaModulesUrlServiceEnvironmentUrlService", ".", "getUrlServiceCfg", "(", ")", ";", "Aria", ".", "load", "(", "{", "classes", ":", "[", "urlServiceCfg", ".", "implementation", "]", ",", "oncomplete", ":", "{", "fn", ":", "this", ".", "__onI18nReady", ",", "scope", ":", "this", ",", "args", ":", "{", "moduleName", ":", "moduleName", ",", "locale", ":", "locale", ",", "callback", ":", "callback", "}", "}", "}", ")", ";", "}" ]
Internal function used to build the request I18N URL. This call is asynchronous as submitJsonRequest. The reason is that it might have to download the urlService implementation class. The final url is added to the arguments passed to the callback <pre> { full : // I18n url built by the implementation } </pre> @param {String} moduleName - the name of the calling module @param {String} the locale to be used @param {aria.core.CfgBeans:Callback} callback Callback called when the full path is ready @return {String} the url
[ "Internal", "function", "used", "to", "build", "the", "request", "I18N", "URL", ".", "This", "call", "is", "asynchronous", "as", "submitJsonRequest", ".", "The", "reason", "is", "that", "it", "might", "have", "to", "download", "the", "urlService", "implementation", "class", ".", "The", "final", "url", "is", "added", "to", "the", "arguments", "passed", "to", "the", "callback" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L644-L659
27,390
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (args) { var urlService = this.__getUrlService(); this.$assert(595, urlService != null); var url = urlService.createI18nUrl(args.moduleName, this.session.id, args.locale); // Add the global parameters url = this.__appendGlobalParams(url, this._params); // Add the url to the callback // Changing the callback arguments is BAD. Keeping this only for backward compatibility. // The right way to pass a result is by using the second parameter of $callback. args.callback.args = args.callback.args || {}; args.callback.args.full = url; this.$callback(args.callback, url); }
javascript
function (args) { var urlService = this.__getUrlService(); this.$assert(595, urlService != null); var url = urlService.createI18nUrl(args.moduleName, this.session.id, args.locale); // Add the global parameters url = this.__appendGlobalParams(url, this._params); // Add the url to the callback // Changing the callback arguments is BAD. Keeping this only for backward compatibility. // The right way to pass a result is by using the second parameter of $callback. args.callback.args = args.callback.args || {}; args.callback.args.full = url; this.$callback(args.callback, url); }
[ "function", "(", "args", ")", "{", "var", "urlService", "=", "this", ".", "__getUrlService", "(", ")", ";", "this", ".", "$assert", "(", "595", ",", "urlService", "!=", "null", ")", ";", "var", "url", "=", "urlService", ".", "createI18nUrl", "(", "args", ".", "moduleName", ",", "this", ".", "session", ".", "id", ",", "args", ".", "locale", ")", ";", "// Add the global parameters", "url", "=", "this", ".", "__appendGlobalParams", "(", "url", ",", "this", ".", "_params", ")", ";", "// Add the url to the callback", "// Changing the callback arguments is BAD. Keeping this only for backward compatibility.", "// The right way to pass a result is by using the second parameter of $callback.", "args", ".", "callback", ".", "args", "=", "args", ".", "callback", ".", "args", "||", "{", "}", ";", "args", ".", "callback", ".", "args", ".", "full", "=", "url", ";", "this", ".", "$callback", "(", "args", ".", "callback", ",", "url", ")", ";", "}" ]
Callback for createI18nUrl. It is called when the urlService implementation classpath is downloaded @param {Object} args Arguments passed to the Aria.load @private
[ "Callback", "for", "createI18nUrl", ".", "It", "is", "called", "when", "the", "urlService", "implementation", "classpath", "is", "downloaded" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L666-L682
27,391
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (requestPath, params) { if (!params || params.length === 0) { // Nothing to do if there are no parameters return requestPath; } // Flatten the array of global parameters var flat = []; for (var i = 0, len = params.length; i < len; i += 1) { var par = params[i]; // The value is already encoded inside the addParam flat.push(par.name + '=' + par.value); } /* * Just in case we want to change it in the future. W3C recommends to use semi columns instead of ampersand * http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 */ var parametersSeparator = "&"; var flatString = flat.join(parametersSeparator); return this.__appendActionParameters(requestPath, flatString); }
javascript
function (requestPath, params) { if (!params || params.length === 0) { // Nothing to do if there are no parameters return requestPath; } // Flatten the array of global parameters var flat = []; for (var i = 0, len = params.length; i < len; i += 1) { var par = params[i]; // The value is already encoded inside the addParam flat.push(par.name + '=' + par.value); } /* * Just in case we want to change it in the future. W3C recommends to use semi columns instead of ampersand * http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 */ var parametersSeparator = "&"; var flatString = flat.join(parametersSeparator); return this.__appendActionParameters(requestPath, flatString); }
[ "function", "(", "requestPath", ",", "params", ")", "{", "if", "(", "!", "params", "||", "params", ".", "length", "===", "0", ")", "{", "// Nothing to do if there are no parameters", "return", "requestPath", ";", "}", "// Flatten the array of global parameters", "var", "flat", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "params", ".", "length", ";", "i", "<", "len", ";", "i", "+=", "1", ")", "{", "var", "par", "=", "params", "[", "i", "]", ";", "// The value is already encoded inside the addParam", "flat", ".", "push", "(", "par", ".", "name", "+", "'='", "+", "par", ".", "value", ")", ";", "}", "/*\n * Just in case we want to change it in the future. W3C recommends to use semi columns instead of ampersand\n * http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2\n */", "var", "parametersSeparator", "=", "\"&\"", ";", "var", "flatString", "=", "flat", ".", "join", "(", "parametersSeparator", ")", ";", "return", "this", ".", "__appendActionParameters", "(", "requestPath", ",", "flatString", ")", ";", "}" ]
Append the global parameters to a url request path. Global parameters are objects with properties name and value @param {String} requestPath The base requestPath @param {Array} params List of parameters (added through addParam) @return {String} the final requestPath @private
[ "Append", "the", "global", "parameters", "to", "a", "url", "request", "path", ".", "Global", "parameters", "are", "objects", "with", "properties", "name", "and", "value" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L692-L715
27,392
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (requestPath, params) { requestPath = requestPath || ""; if (!params) { // Nothing to do if there are no parameters return requestPath; } var idx = requestPath.indexOf('?'); /* * Just in case we want to change it in the future. W3C recommends to use semi columns instead of ampersand * http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 */ var parametersSeparator = "&"; if (idx > -1) { requestPath += parametersSeparator; } else { requestPath += "?"; } return requestPath + params; }
javascript
function (requestPath, params) { requestPath = requestPath || ""; if (!params) { // Nothing to do if there are no parameters return requestPath; } var idx = requestPath.indexOf('?'); /* * Just in case we want to change it in the future. W3C recommends to use semi columns instead of ampersand * http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 */ var parametersSeparator = "&"; if (idx > -1) { requestPath += parametersSeparator; } else { requestPath += "?"; } return requestPath + params; }
[ "function", "(", "requestPath", ",", "params", ")", "{", "requestPath", "=", "requestPath", "||", "\"\"", ";", "if", "(", "!", "params", ")", "{", "// Nothing to do if there are no parameters", "return", "requestPath", ";", "}", "var", "idx", "=", "requestPath", ".", "indexOf", "(", "'?'", ")", ";", "/*\n * Just in case we want to change it in the future. W3C recommends to use semi columns instead of ampersand\n * http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2\n */", "var", "parametersSeparator", "=", "\"&\"", ";", "if", "(", "idx", ">", "-", "1", ")", "{", "requestPath", "+=", "parametersSeparator", ";", "}", "else", "{", "requestPath", "+=", "\"?\"", ";", "}", "return", "requestPath", "+", "params", ";", "}" ]
Append the action parameters to a url request path. Action parameters are strings @param {String} requestPath The base requestPath @param {String} params String with the parameters @return {String} the final requestPath @private
[ "Append", "the", "action", "parameters", "to", "a", "url", "request", "path", ".", "Action", "parameters", "are", "strings" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L724-L746
27,393
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function (actionName) { actionName = actionName || ""; var idx = actionName.indexOf("?"); var object = { name : "", params : "" }; if (idx < 0) { object.name = actionName; } else { object = { name : actionName.substring(0, idx), params : actionName.substring(idx + 1) }; } return object; }
javascript
function (actionName) { actionName = actionName || ""; var idx = actionName.indexOf("?"); var object = { name : "", params : "" }; if (idx < 0) { object.name = actionName; } else { object = { name : actionName.substring(0, idx), params : actionName.substring(idx + 1) }; } return object; }
[ "function", "(", "actionName", ")", "{", "actionName", "=", "actionName", "||", "\"\"", ";", "var", "idx", "=", "actionName", ".", "indexOf", "(", "\"?\"", ")", ";", "var", "object", "=", "{", "name", ":", "\"\"", ",", "params", ":", "\"\"", "}", ";", "if", "(", "idx", "<", "0", ")", "{", "object", ".", "name", "=", "actionName", ";", "}", "else", "{", "object", "=", "{", "name", ":", "actionName", ".", "substring", "(", "0", ",", "idx", ")", ",", "params", ":", "actionName", ".", "substring", "(", "idx", "+", "1", ")", "}", ";", "}", "return", "object", ";", "}" ]
Given an action name extract the request parameters after a question mark @param {String} actionName Action name i.e. "action?par1=2" @return {Object} properties "name" and "params" @private
[ "Given", "an", "action", "name", "extract", "the", "request", "parameters", "after", "a", "question", "mark" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L754-L773
27,394
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function () { if (!this._urlService) { var cfg = ariaModulesUrlServiceEnvironmentUrlService.getUrlServiceCfg(), actionUrlPattern = cfg.args[0], i18nUrlPattern = cfg.args[1]; var ClassRef = Aria.getClassRef(cfg.implementation); this._urlService = new (ClassRef)(actionUrlPattern, i18nUrlPattern); } return this._urlService; }
javascript
function () { if (!this._urlService) { var cfg = ariaModulesUrlServiceEnvironmentUrlService.getUrlServiceCfg(), actionUrlPattern = cfg.args[0], i18nUrlPattern = cfg.args[1]; var ClassRef = Aria.getClassRef(cfg.implementation); this._urlService = new (ClassRef)(actionUrlPattern, i18nUrlPattern); } return this._urlService; }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_urlService", ")", "{", "var", "cfg", "=", "ariaModulesUrlServiceEnvironmentUrlService", ".", "getUrlServiceCfg", "(", ")", ",", "actionUrlPattern", "=", "cfg", ".", "args", "[", "0", "]", ",", "i18nUrlPattern", "=", "cfg", ".", "args", "[", "1", "]", ";", "var", "ClassRef", "=", "Aria", ".", "getClassRef", "(", "cfg", ".", "implementation", ")", ";", "this", ".", "_urlService", "=", "new", "(", "ClassRef", ")", "(", "actionUrlPattern", ",", "i18nUrlPattern", ")", ";", "}", "return", "this", ".", "_urlService", ";", "}" ]
Internal function to get an instance implementation of UrlService @private @return {Object} the instance
[ "Internal", "function", "to", "get", "an", "instance", "implementation", "of", "UrlService" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L780-L787
27,395
ariatemplates/ariatemplates
src/aria/modules/RequestMgr.js
function () { if (!this._requestHandler) { var cfg = ariaModulesRequestHandlerEnvironmentRequestHandler.getRequestHandlerCfg(); this._requestHandler = Aria.getClassInstance(cfg.implementation, cfg.args); } return this._requestHandler; }
javascript
function () { if (!this._requestHandler) { var cfg = ariaModulesRequestHandlerEnvironmentRequestHandler.getRequestHandlerCfg(); this._requestHandler = Aria.getClassInstance(cfg.implementation, cfg.args); } return this._requestHandler; }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_requestHandler", ")", "{", "var", "cfg", "=", "ariaModulesRequestHandlerEnvironmentRequestHandler", ".", "getRequestHandlerCfg", "(", ")", ";", "this", ".", "_requestHandler", "=", "Aria", ".", "getClassInstance", "(", "cfg", ".", "implementation", ",", "cfg", ".", "args", ")", ";", "}", "return", "this", ".", "_requestHandler", ";", "}" ]
Internal function to get an instance implementation of RequestHandler @private @return {Object} the instance
[ "Internal", "function", "to", "get", "an", "instance", "implementation", "of", "RequestHandler" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/modules/RequestMgr.js#L794-L800
27,396
ariatemplates/ariatemplates
src/aria/touch/widgets/Slider.js
function () { var val = this._value; if (val >= this._switchThreshold) { this._onContainer.style.width = this._cfg.width + "px"; this._onContainer.style.left = "0px"; this._offContainer.style.width = "0px"; this._value = 1; } else { this._offContainer.style.width = this._cfg.width + "px"; this._offContainer.style.left = "0px"; this._onContainer.style.width = "0px"; this._value = 0; } if (val !== this._value) { this._storeValue(); } }
javascript
function () { var val = this._value; if (val >= this._switchThreshold) { this._onContainer.style.width = this._cfg.width + "px"; this._onContainer.style.left = "0px"; this._offContainer.style.width = "0px"; this._value = 1; } else { this._offContainer.style.width = this._cfg.width + "px"; this._offContainer.style.left = "0px"; this._onContainer.style.width = "0px"; this._value = 0; } if (val !== this._value) { this._storeValue(); } }
[ "function", "(", ")", "{", "var", "val", "=", "this", ".", "_value", ";", "if", "(", "val", ">=", "this", ".", "_switchThreshold", ")", "{", "this", ".", "_onContainer", ".", "style", ".", "width", "=", "this", ".", "_cfg", ".", "width", "+", "\"px\"", ";", "this", ".", "_onContainer", ".", "style", ".", "left", "=", "\"0px\"", ";", "this", ".", "_offContainer", ".", "style", ".", "width", "=", "\"0px\"", ";", "this", ".", "_value", "=", "1", ";", "}", "else", "{", "this", ".", "_offContainer", ".", "style", ".", "width", "=", "this", ".", "_cfg", ".", "width", "+", "\"px\"", ";", "this", ".", "_offContainer", ".", "style", ".", "left", "=", "\"0px\"", ";", "this", ".", "_onContainer", ".", "style", ".", "width", "=", "\"0px\"", ";", "this", ".", "_value", "=", "0", ";", "}", "if", "(", "val", "!==", "this", ".", "_value", ")", "{", "this", ".", "_storeValue", "(", ")", ";", "}", "}" ]
Update the position of the on and off labels @protected
[ "Update", "the", "position", "of", "the", "on", "and", "off", "labels" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/widgets/Slider.js#L336-L352
27,397
ariatemplates/ariatemplates
src/aria/touch/widgets/Slider.js
function () { var binding = this._binding; if (binding) { ariaUtilsJson.setValue(binding.inside, binding.to, this._value, this._bindingCallback); } }
javascript
function () { var binding = this._binding; if (binding) { ariaUtilsJson.setValue(binding.inside, binding.to, this._value, this._bindingCallback); } }
[ "function", "(", ")", "{", "var", "binding", "=", "this", ".", "_binding", ";", "if", "(", "binding", ")", "{", "ariaUtilsJson", ".", "setValue", "(", "binding", ".", "inside", ",", "binding", ".", "to", ",", "this", ".", "_value", ",", "this", ".", "_bindingCallback", ")", ";", "}", "}" ]
Store the current widget value in the bound location @param {Integer} value Value of the slider @protected
[ "Store", "the", "current", "widget", "value", "in", "the", "bound", "location" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/widgets/Slider.js#L431-L436
27,398
ariatemplates/ariatemplates
src/aria/touch/widgets/Slider.js
function () { var dragVal = this._slider.offsetLeft; this._onContainer.style.width = (this._sliderWidth + dragVal) + "px"; this._offContainer.style.left = dragVal + "px"; this._offContainer.style.width = (this._cfg.width - dragVal) + "px"; }
javascript
function () { var dragVal = this._slider.offsetLeft; this._onContainer.style.width = (this._sliderWidth + dragVal) + "px"; this._offContainer.style.left = dragVal + "px"; this._offContainer.style.width = (this._cfg.width - dragVal) + "px"; }
[ "function", "(", ")", "{", "var", "dragVal", "=", "this", ".", "_slider", ".", "offsetLeft", ";", "this", ".", "_onContainer", ".", "style", ".", "width", "=", "(", "this", ".", "_sliderWidth", "+", "dragVal", ")", "+", "\"px\"", ";", "this", ".", "_offContainer", ".", "style", ".", "left", "=", "dragVal", "+", "\"px\"", ";", "this", ".", "_offContainer", ".", "style", ".", "width", "=", "(", "this", ".", "_cfg", ".", "width", "-", "dragVal", ")", "+", "\"px\"", ";", "}" ]
Move the On and Off state elements @protected
[ "Move", "the", "On", "and", "Off", "state", "elements" ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/widgets/Slider.js#L457-L462
27,399
ariatemplates/ariatemplates
src/aria/touch/widgets/Slider.js
function () { var pos = this._savedX, newValue = Math.max(pos / this._railWidth, 0); if (newValue !== this._value) { this._value = newValue; this._storeValue(); } else { this._notifyDataChange(); } return; }
javascript
function () { var pos = this._savedX, newValue = Math.max(pos / this._railWidth, 0); if (newValue !== this._value) { this._value = newValue; this._storeValue(); } else { this._notifyDataChange(); } return; }
[ "function", "(", ")", "{", "var", "pos", "=", "this", ".", "_savedX", ",", "newValue", "=", "Math", ".", "max", "(", "pos", "/", "this", ".", "_railWidth", ",", "0", ")", ";", "if", "(", "newValue", "!==", "this", ".", "_value", ")", "{", "this", ".", "_value", "=", "newValue", ";", "this", ".", "_storeValue", "(", ")", ";", "}", "else", "{", "this", ".", "_notifyDataChange", "(", ")", ";", "}", "return", ";", "}" ]
Set the value of the slider in the data model. @param {Number} newValue new value @protected
[ "Set", "the", "value", "of", "the", "slider", "in", "the", "data", "model", "." ]
7ed5d065818ae159bf361c9dfb209b1cf3883c90
https://github.com/ariatemplates/ariatemplates/blob/7ed5d065818ae159bf361c9dfb209b1cf3883c90/src/aria/touch/widgets/Slider.js#L469-L478