X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-widget.js;h=05e39ca2ee9ca0e6026d2ab3454bfff08a4635b6;hp=534e4b365ff84c9834aace1df2b488846aa29cc6;hb=699f025fbabc9fffb5f78e9f4f927ccdd9fdb936;hpb=082245055cc0cae23ee2ae08c5a5a8a32a1a1c89 diff --git a/src/mkws-widget.js b/src/mkws-widget.js index 534e4b3..05e39ca 100644 --- a/src/mkws-widget.js +++ b/src/mkws-widget.js @@ -1,5 +1,5 @@ // Factory function for widget objects. -function widget($, team, type, node) { +mkws.makeWidget = function($, team, type, node) { // Static register of attributes that do not contribute to config var ignoreAttrs = { id:1, 'class':1, style:1, name:1, action:1, type:1, size:1, @@ -10,13 +10,15 @@ function widget($, team, type, node) { team: team, type: type, node: $(node), - config: mkws.objectInheritingFrom(team.config()) + config: mkws.objectInheritingFrom(team.config) }; - function log(s) { - team.log(s); - } - that.log = log; + that.trace = team.trace; + that.debug = team.debug; + that.info = team.info; + that.warn = team.warn; + that.error = team.error; + that.fatal = team.fatal; that.toString = function() { return '[Widget ' + team.name() + ':' + type + ']'; @@ -38,26 +40,26 @@ function widget($, team, type, node) { for (var name in this.config) { if (this.config.hasOwnProperty(name)) { attrs[name] = this.config[name]; - log(this + " copied property " + name + "='" + attrs[name] + "' to " + type + " subwidget"); + this.info(this + " copied property " + name + "='" + attrs[name] + "' to " + type + " subwidget"); } } for (var name in overrides) { + this.info(this + " overrode property " + name + "='" + overrides[name] + "' (was '" + attrs[name] + "') for " + type + " subwidget"); attrs[name] = overrides[name]; - log(this + " overrode property " + name + "='" + attrs[name] + "' for " + type + " subwidget"); } if (defaults) { for (var name in defaults) { if (!attrs[name]) { attrs[name] = defaults[name]; - log(this + " fell back to default property " + name + "='" + attrs[name] + "' for " + type + " subwidget"); + this.info(this + " fell back to default property " + name + "='" + attrs[name] + "' for " + type + " subwidget"); } } } var s = []; - s.push('