src/js/widgets.js
branchpopcorn-port
changeset 830 18ca612e9ff0
parent 826 c7ae4f126e51
child 835 a8af9da7c622
--- a/src/js/widgets.js	Tue Mar 06 13:26:51 2012 +0100
+++ b/src/js/widgets.js	Thu Mar 08 18:38:46 2012 +0100
@@ -50,29 +50,32 @@
   } 
 
   if (config.hasOwnProperty("layoutManager")) {
-     this.layoutManager = config.layoutManager;     
+     this.layoutManager = config.layoutManager;
   }
-  if (typeof this.selector != "undefined" && typeof Popcorn != "undefined") {
-      var _id = this._id;
-      this.selector.bind("click mouseover mouseout dragstart dragstop", function(_e) {
-            var _data = {
-                "type": _e.type,
-                "x": _e.clientX,
-                "y": _e.clientY,
-                "widget": _id,
-                "target_name": _e.target.localName,
-                "target_id": _e.target.id,
-                "target_class": _e.target.className,
-                "text": _e.target.textContent.trim(),
-                "title": _e.target.title,
-                "value": _e.target.value
-            };
-            Popcorn.trigger('IriSP.Widget.MouseEvents', _data);
-      })
+  if (typeof this.selector != "undefined") {
+      this.selector.addClass("Ldt-TraceMe").addClass("Ldt-Widget");
   }
   
 };
 
+// This functions checks for configuration options
+
+IriSP.Widget.prototype.checkOption = function(_name, _default) {
+    this[_name] = (
+        typeof this._config[_name] != "undefined"
+        ? this._config[_name]
+        : (
+            (typeof IriSP.widgetsDefaults[this._config.type] != "undefined" && IriSP.widgetsDefaults[this._config.type][_name] != "undefined")
+            ? IriSP.widgetsDefaults[this._config.type][_name]
+            : (
+                typeof _default != "undefined"
+                ? _default
+                : null
+            )
+        )
+    )
+}
+
 /**
   * This method responsible of drawing a widget on screen.
   */