Author: jmorliaguet
Date: Fri Jan  6 16:17:10 2006
New Revision: 2158

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html
Log:

- the view notify the controller when an action is taken
  (push method)



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 Fri Jan  6 
16:17:10 2006
@@ -61,10 +61,21 @@
     });
   },
 
+  /* Controller */
   getHandlers: function(controller) {
     return this.Controllers[controller].handlers;
   },
 
+  notify: function(view, object, action, param) {
+    var controller = view.getAttribute("controller");
+    if (!controller) return;
+    var handlers = this.Controllers[controller].handlers;
+    var handler = handlers[action];
+    if (handler) {
+      handler(object, param);
+    }
+  },
+
   _resolvePerspective: function(perspective) {
     var path = CPSSkins.CurrentPerspective.split("/");
     var base = perspective;
@@ -513,9 +524,6 @@
 
     this.active = false;
 
-    var controller = view.getAttribute("controller");
-    this.handlers = CPSSkins.getHandlers(controller);
-
     this.showEvent = this.showEvent.bindAsEventListener(this);
     this.hideEvent = this.hideEvent.bindAsEventListener(this);
     this.callEvent = this.callEvent.bindAsEventListener(this);
@@ -566,11 +574,9 @@
     if (confirm) {
       if (!window.confirm(confirm)) return;
     }
-    var handler = this.handlers[action];
-    if (handler) {
-      handler(this.selected, choice);
-      this.active = false;
-    }
+    /* notify the controller */
+    CPSSkins.notify(this.view, this.selected, action, choice);
+    this.active = false;
   },
 
   mouseOverEvent: function(e) {

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html   
    (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html   
    Fri Jan  6 16:17:10 2006
@@ -293,7 +293,7 @@
       assertEqual(CPSSkins.CurrentPerspective, "2/1/3/4/7/8");
 
       CPSSkins.switchPerspective("-");
-      assertEqual(CPSSkins.CurrentPerspective, "2/1/3/4/7/9");
+      assertEqual(CPSSkins.CurrentPerspective, "2/1/3/4/9");
 
     }}
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to