Changeset 2384
- Timestamp:
- 02/15/06 12:22:40 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
r2381 r2384 796 796 // high-level I/O 797 797 getData: function() { 798 this.storage.re questData(); /* asynchronous call */798 this.storage.readTransaction(); /* asynchronous call */ 799 799 return this.storage.read(); 800 800 }, 801 801 802 802 setData: function(data) { 803 this.storage. storeData(data);803 this.storage.writeTransaction(data); 804 804 }, 805 805 … … 872 872 this.model = model; 873 873 this.setup(); 874 this._queue = $A([]); 875 this._queued_data = $H({}); 876 }, 877 878 readTransaction: function(data) { 879 // TODO: implement a read access sequences 880 this.requestData(); 881 }, 882 883 writeTransaction: function(data) { 884 var access = this.model.def.storage.access; 885 if (access) { 886 switch (access.type) { 887 case 'queue': { 888 this._queue.push(data[access.signature]); 889 break; 890 } 891 case 'stack': { 892 this._queue.unshift(data[access.signature]); 893 break; 894 } 895 } 896 } 897 this.storeData(data); 874 898 }, 875 899 … … 893 917 894 918 write: function(data) { 919 var access = this.model.def.storage.access; 920 921 if (access && access.type) { 922 var signature = data[access.signature]; 923 this._queued_data[signature] = data; 924 while (this._queue) { 925 var next = this._queue[0]; 926 if (next in this._queued_data) { 927 data = this._queued_data[next]; 928 this._writeFields(data); 929 this._queue.shift(); 930 } else { 931 break; 932 } 933 } 934 } else { 935 this._writeFields(data); 936 } 937 }, 938 939 _writeFields: function(data) { 895 940 // filter out fields with the wrong data type 896 941 var schema = this.model.schema; cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt
r2383 r2384 46 46 function init() { 47 47 run('no-sequence', 1); 48 run(' stack-sequence', 2);49 run(' queue-sequence', 3);48 run('queue-sequence', 2); 49 run('stack-sequence', 3); 50 50 } 51 51 52 52 function run(model_id, storage) { 53 53 var model = CPSSkins.getModelById(model_id); 54 $R(1, 20).each(function(v) {54 $R(1,10).each(function(v) { 55 55 model.setData({'storage': storage, 'position': v, 's': v}); 56 56 }); … … 167 167 "type": "counter" 168 168 }, 169 "model": " stack-sequence"169 "model": "queue-sequence" 170 170 } 171 171 </ins> … … 177 177 "type": "counter" 178 178 }, 179 "model": " queue-sequence"179 "model": "stack-sequence" 180 180 } 181 181 </ins>
