Author: jmorliaguet Date: Sat Feb 18 23:28:45 2006 New Revision: 2427 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html Log:
- simplified the effect API - added a 'render_effect' when the widget is rendered. 'show_effect' is when the widget is shown, and 'hide_effect' is when the widget is hidden 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 Feb 18 23:28:45 2006 @@ -1191,9 +1191,6 @@ this.widget = widget; this.def = def; - this.show_effect = def.show_effect || {}; - this.hide_effect = def.hide_effect || {}; - this.setup(); }, @@ -1238,6 +1235,10 @@ display: function(data) { this.render(data); + if (this.def.render_effect) { + Element.hide(this.widget); + this.applyEffect(this.widget, this.def.render_effect) + } CPSSkins.notify("displayed", {'publisher': this}); }, @@ -1254,17 +1255,10 @@ // prepare the view this.prepare(); - if (this.effect) { - this.effect.stop(); - } - - var widget = this.widget; - var show_effect = this.show_effect; - if (show_effect) { - show_effect.transition = show_effect.transition || "show"; - this.effect = this.applyEffect(widget, show_effect) + if (this.def.show_effect) { + this.applyEffect(this.widget, this.def.show_effect) } else { - Element.show(widget); + Element.show(this.widget); } this.visible = true; }, @@ -1273,17 +1267,11 @@ if (!this.visible) { return; } - var widget = this.widget; - if (this.effect && !this.effect.started) { - this.effect.stop(); - } - var hide_effect = this.hide_effect; - if (hide_effect) { - hide_effect.transition = hide_effect.transition || "hide"; - this.effect = this.applyEffect(widget, hide_effect); + if (this.def.hide_effect) { + this.applyEffect(this.widget, this.def.hide_effect); } else { - Element.hide(widget); + Element.hide(this.widget); } this.visible = false; @@ -1294,9 +1282,12 @@ }, applyEffect: function(node, options) { - if (options.transition in CPSSkins.Effects) { - return CPSSkins.Effects[options.transition](node, options) - } + if (this.effect) { + this.effect.stop(); + } + if (options.transition in CPSSkins.Effects) { + this.effect = CPSSkins.Effects[options.transition](node, options) + } } } Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_progressive_enhancement.html Sat Feb 18 23:28:45 2006 @@ -58,8 +58,10 @@ "template": "ajax_widget_template.pt", "replace": "htmlwidget" }, - "model": "ram-data-provider" - } + "model": "ram-data-provider", + "render_effect": { + "transition": "fadein" + }} </ins> </body> Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_widget_templates.html Sat Feb 18 23:28:45 2006 @@ -70,7 +70,10 @@ {"widget": { "template": "template.pt" }, - "model": "template-data" + "model": "template-data", + "render_effect": { + "transition": "fadein" + } } </ins> -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins