Author: jmorliaguet
Date: Mon Jan 16 01:56:20 2006
New Revision: 2225

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_observer_test.html
Log:

- more elegant code now that there is a Model. no need to access the Canvas
  directly.



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 Mon Jan 16 
01:56:20 2006
@@ -563,6 +563,14 @@
 
   getData: function() {
     return Canvas.getNodeData(this.node);
+  },
+
+  setData: function(data) {
+    Canvas.setNodeData(this.node, data)
+  },
+
+  updateData: function(data) {
+    Canvas.updateNodeData(this.node, data)
   }
 
 }

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_observer_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_observer_test.html
        (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_observer_test.html
        Mon Jan 16 01:56:20 2006
@@ -50,6 +50,13 @@
 
   <script type="text/javascript">
     var timer = null;
+    var model;
+
+    Event.observe(window, "load", init);
+
+    function init() {
+      model = new CPSSkins.Model("data-provider");
+    }
 
     function start() {
       if (timer) return;
@@ -62,11 +69,11 @@
     }
 
     function updateModel() {
-      var data = Canvas.getNodeData("data-provider");
+      var data = model.getData();
       data.size += 1;
       data.hint = "The size is now " + data.size;
       data.sizeinfo[0].label = data.size;
-      Canvas.updateNodeData("data-provider", data);
+      model.updateData(data);
     }
 
     Object.extend(Widgets, {
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to