[Z3lab-checkins] r2389 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency
Author: jmorliaguet Date: Thu Feb 16 10:10:18 2006 New Revision: 2389 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Log: - added typewriter demo Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/browser.py Thu Feb 16 10:10:18 2006 @@ -17,7 +17,9 @@ # this only simulates latency on the server. # network latency can be simulated with the AJAX Proxy tool # (https://sourceforge.net/projects/jpspan/) -time.sleep(random.randint(1, 4)) +latency = data.get('latency') +if latency: +time.sleep(random.randint(1, latency)) storage = data['storage'] cache.set(data, storage, {}) Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/configure.zcml Thu Feb 16 10:10:18 2006 @@ -9,6 +9,14 @@ template=cpsskins_latency.pt / + browser:page + for=* + layer=cpsskins-test + name=cpsskins_typewriter.html + permission=zope.Public + template=cpsskins_typewriter.pt + / + browser:pages layer=cpsskins-test for=* Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_latency.pt Thu Feb 16 10:10:18 2006 @@ -50,7 +50,8 @@ function run(model_id, storage) { var model = CPSSkins.getModelById(model_id); $R(1,10).each(function(v) { -model.setData({'storage': storage, 'position': v, 's': v}); +model.setData({'storage': storage, 'position': v, 's': v, + 'latency': 2}); }); } Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt == --- (empty file) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/latency/cpsskins_typewriter.pt Thu Feb 16 10:10:18 2006 @@ -0,0 +1,187 @@ +!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN + http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; +html xml:lang=en lang=en + xmlns=http://www.w3.org/1999/xhtml; +head + titleCPSSkins Unit test file/title + meta http-equiv=content-type content=text/html; charset=utf-8 / + script src=/++skin++cpsskins/@@/++resource++prototype.js + type=text/javascript/script + script src=/++skin++cpsskins/@@/++resource++json.js + type=text/javascript/script + script src=/++skin++cpsskins/@@/++resource++cpsskins.js + type=text/javascript/script + link rel=stylesheet type=text/css +href=/++skin++cpsskins/@@/++resource++cpsskins.css / + + style type=text/css + table.results { +width: 100%; + } + table.results th { +background-color: #eee; +border: 1px solid #ccc; + } + table.results td { +width: 50%; +border: 1px solid #ccc; + } + .car { +font: 20px serif; + } + form { +padding: 0.5em; +margin: 2px; + } + label { +font: bold 20px Arial; + } + input { +color: #000; +border: 1px solid #ccc; +border-style: none none solid none; +font: 22px serif; +padding: 0.2em; + } + input:focus { +border-color: #000; + } + /style + + script type=text/javascript +var model, s=0; + +Event.observe(window, load, init); + +function init() { + + var onKeyPressEvent = function(e) { +var key = e.charCode; +if (!key) return; +s += 1; +var model1 = CPSSkins.getModelById(no-sequence); +var model2 = CPSSkins.getModelById(queue-sequence); +model1.setData({'storage': 1, 'position': key, 's': s, 'latency': 2}); +model2.setData({'storage': 2, 'position': key, 's': s,
[Z3lab-checkins] r2390 - cpsskins/branches/jmo-perspectives/ui/framework/tests/unit
Author: jmorliaguet Date: Thu Feb 16 22:46:37 2006 New Revision: 2390 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_test.html Log: - test updates 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 Thu Feb 16 22:46:37 2006 @@ -73,57 +73,117 @@ /div + ins class=model + {id: p1, + data: { + url: p1.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p2, + data: { + url: p2.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p3, + data: { + url: p3.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p1_2, + data: { + url: p1_2.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p2_3, + data: { + url: p2_3.html +}, +storage: { + type: ram + }} + /ins + + ins class=model + {id: p2_3_1, + data: { + url: p2_3_1.html +}, +storage: { + type: ram + }} + /ins + !-- panels -- ins class=view {widget: { - type: panel, - url: p1.html + type: panel }, + model: p1, perspectives: [1] } /ins ins class=view {widget: { - type: panel, - url: p2.html + type: panel }, + model: p2, perspectives: [1, 2] } /ins ins class=view {widget: { - type: panel, - url: p3.html + type: panel }, + model: p3, perspectives: [3] } /ins ins class=view {widget: { - type: panel, - url: p1_2.html + type: panel }, + model: p1_2, perspectives: [1/2] } /ins ins class=view {widget: { - type: panel, - url: p2_3.html + type: panel }, + model: p2_3, perspectives: [2/3] } /ins ins class=view {widget: { - type: panel, - url: p2_3_1.html + type: panel }, + model: p2_3_1, perspectives: [2/3/1] } /ins -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2391 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/functional tests/zope3/functional/chat tests/zope3/functional/forms tests/zope3/functional/quiz
Author: jmorliaguet Date: Thu Feb 16 22:55:02 2006 New Revision: 2391 Added: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data3.txt (contents, props changed) Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_external_sources.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_tooltip.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data1.txt cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/data2.txt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/chat/cpsskins_chat.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/cpsskins_form_validation.pt cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/quiz/cpsskins_quiz.pt Log: - a same view can have several controllers registered at the same time - added a Focus Observer (a controller that receives gained focus and lost focus events coming from objects that are clicked on or that temporarily get some focus. - the controller makes the view observe the model of the object that gained focus - when the object loses focus, the controller makes the view stops observing the model this is currently used with contextual menus and with tooltips 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 Thu Feb 16 22:55:02 2006 @@ -265,16 +265,20 @@ CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); } -/* register the controller */ -var controller_id = def.controller || null; -if (controller_id) { - var evt_id = registered controller + controller_id; +/* register the controllers */ +var controllers_id = def.controllers || []; +$A(controllers_id).each(function(c) { + var evt_id = registered controller + c; CPSSkins.registerEventHandler(evt_id, view, function(event) { var controller = event.target; -controller.control(view); +controller.view = view; +controller.register(view); +// add a back-reference +view.controller = controller; + }); CPSSkins.subscribe(evt_id, {'subscriber': view, 'target': null}); -} +}); /* insert the widget into the DOM */ var replace = def.widget.replace; @@ -385,7 +389,7 @@ this.def = def; }, - control: function(view) { + register: function(view) { /* to override */ } @@ -394,12 +398,16 @@ if (!window.Controllers) { var Controllers = new Object(); } Object.extend(Controllers, { - command: function(node, def) { + 'command': function(node, def) { return new CPSSkins.CommandController(node, def); }, - form: function(node, def) { + 'form': function(node, def) { return new CPSSkins.FormController(node, def); + }, + + 'focus observer': function(node, def) { +return new CPSSkins.FocusObserver(node, def); } }); @@ -407,10 +415,9 @@ CPSSkins.CommandController = Class.create(); CPSSkins.CommandController.prototype = Object.extend(new CPSSkins.Controller(), { - control: function(view) { + register: function(view) { var controller = this; -view.controller = controller; CPSSkins.registerEventHandler(command, view, function(info) { var view = info.subscriber; @@ -438,10 +445,7 @@ CPSSkins.FormController = Class.create(); CPSSkins.FormController.prototype = Object.extend(new CPSSkins.Controller(), { - control: function(view) { -this.view = view; -var controller = this; -view.controller = controller; + register: function(view) { var widget = view.widget; @@ -466,6 +470,35 @@ }); +CPSSkins.FocusObserver = Class.create(); +CPSSkins.FocusObserver.prototype = Object.extend(new CPSSkins.Controller(), { + + register: function(view) { + +var controller = this; + +CPSSkins.registerEventHandler(gained focus, controller, function(info) { + var view = info.target; + var selected = info.context; + if (!view.def.model) { +var model = Canvas.getModel(selected); +if (model) { + view.observe(model); +} + } +}); + +CPSSkins.registerEventHandler(lost focus, controller, function(info) { + var view = info.target; +
[Z3lab-checkins] r2392 - cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms
Author: jmorliaguet Date: Thu Feb 16 23:29:53 2006 New Revision: 2392 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/sampleform.pt Log: - temporary fix for not submitting the form Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/sampleform.pt == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/sampleform.pt (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/zope3/functional/forms/sampleform.pt Thu Feb 16 23:29:53 2006 @@ -1,4 +1,4 @@ -form action= method=post +form action= method=post onsubmit=return false p ctal:repeat=f fields label ctal:content=f/labelLABEL/label -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2393 - in cpsskins/branches/jmo-perspectives/ui/framework: . tests/unit
Author: jmorliaguet Date: Fri Feb 17 00:09:39 2006 New Revision: 2393 Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log: - the 'javascript:...' notation evaluates the expression in the context of the data. with: data = { items: [{'title': 'test'}, ...] } div ctal:repeat=item items span ctal:content=item/title.../span /div is equivalent to: div ctal:repeat=item items span ctal:content=javascript:item['title'].../span /div Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js == --- cpsskins/branches/jmo-perspectives/ui/framework/ctal.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/ctal.js Fri Feb 17 00:09:39 2006 @@ -238,7 +238,8 @@ } else if (etype == 'path') { return ctal.eval_pathexpr(data, value) } else if (etype == 'javascript') { -return eval(value) +// evaluate the expression in context +return data.eval(value); } else { throw new ctal.TALESError('TALES Expression type ' + etype + ' is not implemented') Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Fri Feb 17 00:09:39 2006 @@ -280,7 +280,7 @@ div id=e31bspan ctal:content=javascript:1+1.../span/div div id=e31cspan -ctal:content=javascript:data['k']['l']['m'].../span/div +ctal:content=javascript:k['l']['m'].../span/div !-- edge cases -- -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins
[Z3lab-checkins] r2394 - cpsskins/branches/jmo-perspectives/ui/framework/tests/unit
Author: jmorliaguet Date: Fri Feb 17 00:18:21 2006 New Revision: 2394 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log: - added info about a test that does not pass. Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html == --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Fri Feb 17 00:18:21 2006 @@ -507,6 +507,8 @@ testEdgeCases: function() { with(this) { assertEqual('', htmlOf(e32)); assertEqual('pspan1/span/ppspan2/span/p', htmlOf(e33)); + + // XXX: this one does not pass yet assertEqual('', htmlOf(e34)); }} -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins