Author: jmorliaguet
Date: Fri Jan  6 23:24:50 2006
New Revision: 2167

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

- observer test:

  a counter (data model) is incremented every second, 2 different view observe
  the same model and get updated when the data changes.



Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_model_view_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_model_view_test.html
      (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_model_view_test.html
      Fri Jan  6 23:24:50 2006
@@ -12,6 +12,16 @@
   <script src="../../cpsskins.js" type="text/javascript"></script>
   <link rel="stylesheet" href="../../cpsskins.css" type="text/css" />
 
+  <style type="text/css">
+    .grid {
+      border: 1px solid orange;
+      background-color: #ffc;
+      padding: 1.5em;
+      margin: 1em;
+      font-size: 2em;
+    }
+  </style>
+
   <script type="text/javascript">
     Event.observe(window, "load", start);
     var timer;
@@ -25,6 +35,31 @@
       data.size += 1;
       Canvas.updateNodeData("data-provider", data);
     }
+
+    Object.extend(Widgets, {
+      grid: function(view, index) {
+        var widget = Canvas.addNode(document.body, {
+        tag: "div",
+        class: "grid"
+        });
+        return new Grid(widget, view);
+      }
+    });
+
+    Grid= Class.create();
+    Grid.prototype = {
+
+      initialize: function(widget, view) {
+        this.widget = widget;
+        this.view = view;
+      },
+
+      update: function(data) {
+        this.widget.innerHTML = data.size;
+      }
+
+    }
+
   </script>
 
 </head>
@@ -40,6 +75,7 @@
 
   <cpsskins:view widget="grid" observe="data-provider"></cpsskins:view>
 
+  <cpsskins:view widget="grid" observe="data-provider"></cpsskins:view>
 
 </body>
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to