Author: jmorliaguet Date: Sat Mar 4 00:17:30 2006 New Revision: 2518 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log:
- fixes: we use component ids when sending events between models and views 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 Sat Mar 4 00:17:30 2006 @@ -287,8 +287,7 @@ var evt_id = "registered controller " + c; CPSSkins.registerEventHandler(evt_id, view, function(event) { var controller = event.publisher; - controller.views.add(id); - controller.register(view); + controller.observe(view); CPSSkins.unsubscribe(evt_id); }); CPSSkins.subscribe(evt_id, {'subscriber': view}); @@ -372,14 +371,22 @@ this.views = new CPSSkins.Set(); }, + getId: function() { + return this.def.id; + }, + setup: function() { /* to override */ }, register: function(view) { /* to override */ - } + }, + observe: function(view) { + this.views.add(view.getId()); + this.register(view); + } } CPSSkins.registerControllers({ @@ -968,6 +975,10 @@ this.storage = this._setStorageAdapter(); }, + getId: function() { + return this.def.id; + }, + // low-level I/O readData: function() { return this._data || this.def.data; @@ -1004,12 +1015,15 @@ var data = event.publisher.readData(); event.subscriber.display(data); }); - CPSSkins.subscribe('modified', {'subscriber': view, 'publisher': model}); + CPSSkins.subscribe('modified', + {'subscriber': view.getId(), 'publisher': this.getId()} + ); }, removeObserver: function(view) { - var model = this; - CPSSkins.unsubscribe('modified', {'subscriber': view, 'publisher': model}); + CPSSkins.unsubscribe('modified', + {'subscriber': view.getId(), 'publisher': this.getId()} + ); }, /* Private API */ @@ -1322,6 +1336,10 @@ this.setup(); }, + getId: function() { + return this.def.id; + }, + /* Public API */ inspect: function() { return "[CPSSkins " + this.def.widget + "]"; -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins