Author: jmorliaguet
Date: Tue Mar  7 13:58:24 2006
New Revision: 2554

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
Log:

- we use $(node).xyz() instead of Element.xyz(node)



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Tue Mar  7 
13:58:24 2006
@@ -86,7 +86,7 @@
   /* Error handling */
   warn: function(msg, context) {
     var div = document.createElement("div");
-    Element.addClassName(div, "warningMessage");
+    $(div).addClassName("warningMessage");
     div.innerHTML = msg;
     context.parentNode.replaceChild(div, context);
   },
@@ -253,7 +253,7 @@
     var elements = $A(node.getElementsByTagName("ins"));
     ["view", "controller", "model"].each(function(type) {
       elements.each(function(el) {
-        if (Element.hasClassName(el, type)) {
+        if ($(el).hasClassName(type)) {
           CPSSkins._register(node, el, type);
         }
       });
@@ -796,7 +796,7 @@
     while(node = node.previousSibling) {
       if (node.nodeType == 1) {
         if (node && node.tagName.toLowerCase() == "ins"
-                 && Element.hasClassName(node, "model")) {
+                 && $(node).hasClassName("model")) {
           return node;
         } else {
           return null;
@@ -807,9 +807,9 @@
   },
 
   createNode: function(options) {
-    var node = document.createElement(options.tag);
-    Element.addClassName(node, options.classes);
-    Element.setStyle(node, options.style);
+    var node = $(document.createElement(options.tag));
+    node.addClassName(options.classes);
+    node.setStyle(options.style);
     $H(options.attributes).each(function(attr) {
       node.setAttribute(attr.key, attr.value)
     });
@@ -837,7 +837,7 @@
   fitInsideScreen: function(node) {
     node = $(node);
     Position.absolutize(node);
-    var dimensions = Element.getDimensions(node);
+    var dimensions = node.getDimensions();
     var width = dimensions.width;
     var height = dimensions.height;
     var page_w = window.innerWidth || document.body.clientWidth;
@@ -951,10 +951,10 @@
     if (delay) {
       return new CPSSkins.Scheduler({
         delay: delay,
-        onComplete: function() { Element.show(node); }
+        onComplete: function() { node.show(); }
       });
     } else {
-      Element.show(node);
+      node.show();
     }
   },
 
@@ -963,10 +963,10 @@
     if (delay) {
       return new CPSSkins.Scheduler({
         delay: delay,
-        onComplete: function() { Element.hide(node); }
+        onComplete: function() { node.hide(); }
       });
     } else {
-      Element.hide(node);
+      node.hide();
     }
   },
 
@@ -977,7 +977,7 @@
       delay: options.delay,
       duration: options.duration,
       action: function(value) { setOpacity(node, value) },
-      onComplete: function() { Element.show(node) }
+      onComplete: function() { node.show() }
     });
   },
 
@@ -986,34 +986,34 @@
     setOpacity(node, 1);
     Object.extend(options, {
       action: function(value) { setOpacity(node, 1-value) },
-      onComplete: function() { Element.hide(node) }
+      onComplete: function() { node.hide() }
     });
     return new CPSSkins.Scheduler(options);
   },
 
   blinddown: function(node, options) {
-    var height = Element.getHeight(node);
-    Element.makeClipping(node);
+    var height = node.getHeight();
+    node.makeClipping();
     Object.extend(options, {
       action: function(value) {
-        Element.setStyle(node, {height: height*value + 'px'});
+        node.setStyle({height: height*value + 'px'});
       },
       onComplete: function() {
-        Element.setStyle(node, {height: height + 'px'});
-        Element.undoClipping(node);
+        node.setStyle({height: height + 'px'});
+        node.undoClipping();
       }
     });
     return new CPSSkins.Scheduler(options);
   },
 
   blindup: function(node, options) {
-    var height = Element.getHeight(node);
-    Element.makeClipping(node);
+    var height = node.getHeight();
+    node.makeClipping();
     Object.extend(options, {
       action: function(value) {
-        Element.setStyle(node, {height: height*(1-value) + 'px'});
+        node.setStyle({height: height*(1-value) + 'px'});
       },
-      onComplete: function() { Element.setStyle(node, {height: '0px'}); }
+      onComplete: function() { node.setStyle({height: '0px'}); }
     });
     return new CPSSkins.Scheduler(options);
   }
@@ -1070,7 +1070,8 @@
     var model = this;
     // observers subscribes to events on the model
     CPSSkins.registerEventHandler('changed', view, function(event) {
-      event.subscriber.refresh();
+      var view = event.subscriber;
+      view.refresh();
     });
     CPSSkins.subscribe('changed', {'subscriber': view, 'publisher': model});
   },
@@ -1103,6 +1104,7 @@
 
     // the model reacts to events on the storage and notifies observers
     CPSSkins.registerEventHandler('stored', model, function(event) {
+      var model = event.subscriber;
       CPSSkins.notify('changed', {'publisher': model});
     });
 
@@ -1459,7 +1461,7 @@
   display: function(data) {
     this.render(data);
     if (this.def.render_effect) {
-      Element.hide(this.widget);
+      $(this.widget).hide();
       this.applyEffect(this.widget, this.def.render_effect)
     }
     CPSSkins.notify("displayed", {'publisher': this});
@@ -1467,6 +1469,7 @@
 
   show: function() {
     if (this._visible) { return }
+    var widget = $(this.widget);
 
     CPSSkins.notify("gained focus", {'publisher': this,
                                      'context': this.selected});
@@ -1478,9 +1481,9 @@
     this.prepare();
 
     if (this.def.show_effect) {
-      this.applyEffect(this.widget, this.def.show_effect)
+      this.applyEffect(widget, this.def.show_effect)
     } else {
-      Element.show(this.widget);
+      widget.show();
     }
     this._visible = true;
   },
@@ -1489,11 +1492,12 @@
     if (!this._visible) {
       return;
     }
+    var widget = $(this.widget);
 
     if (this.def.hide_effect) {
-      this.applyEffect(this.widget, this.def.hide_effect);
+      this.applyEffect(widget, this.def.hide_effect);
     } else {
-      Element.hide(this.widget);
+      widget.hide();
     }
 
     this._visible = false;
@@ -1695,9 +1699,9 @@
     if (!element) return null;
     var nodes = element.childNodes;
     for (var i=0;i<nodes.length;i++) {
-      var node = nodes[i];
+      var node = $(nodes[i]);
       if (node.nodeType != 1) continue;
-      if (!Element.hasClassName(node, "submenu")) continue;
+      if (!node.hasClassName("submenu")) continue;
       return node;
     }
     return null;
@@ -1814,7 +1818,7 @@
           }));
 
           if (!this.submenuLeft) {
-            this.submenuLeft = Element.getDimensions(this.widget).width -2;
+            this.submenuLeft = $(this.widget).getDimensions().width -2;
           }
 
           var submenu = createNode({
@@ -1901,16 +1905,16 @@
 
   mouseOverEvent: function(e) {
     var here = Event.element(e);
-    if (Element.hasClassName(here, "submenuitem")) {
+    if ($(here).hasClassName("submenuitem")) {
       var menu = this._getSubmenu(here);
       if (!menu) return;
 
       document.getElementsByClassName("submenu", here.parentNode).each(
         function(v) {
-          Element.hide(v);
+          $(v).hide();
         }
       );
-      Element.show(menu);
+      $(menu).show();
     }
   }
 });
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to