]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - jssource/src_files/include/ytree/TreeView/anim/TVAnim.js
Release 6.5.0
[Github/sugarcrm.git] / jssource / src_files / include / ytree / TreeView / anim / TVAnim.js
1 /* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
2
3 /**
4  * A static factory class for tree view expand/collapse animations
5  *
6  * @constructor
7  */
8 YAHOO.widget.TVAnim = new function() {
9         /**
10          * Constant for the fade in animation
11          * 
12          * @type string
13          */
14         this.FADE_IN  = "YAHOO.widget.TVFadeIn";
15
16         /**
17          * Constant for the fade out animation
18          * 
19          * @type string
20          */
21         this.FADE_OUT = "YAHOO.widget.TVFadeOut";
22
23         /**
24          * Returns a ygAnim instance of the given type
25          *
26          * @param type {string} the type of animation
27          * @param el {HTMLElement} the element to element (probably the children div)
28          * @param callback {function} function to invoke when the animation is done.
29          * @return {YAHOO.util.Animation} the animation instance
30          */
31         this.getAnim = function(type, el, callback) {
32                 switch (type) {
33                         case this.FADE_IN:      return new YAHOO.widget.TVFadeIn(el, callback);
34                         case this.FADE_OUT:     return new YAHOO.widget.TVFadeOut(el, callback);
35                         default:                        return null;
36                 }
37         };
38
39         /**
40          * Returns true if the specified animation class is available
41          *
42          * @param type {string} the type of animation
43          * @return {boolean} true if valid, false if not
44          */
45         this.isValid = function(type) {
46                 return ( "undefined" != eval("typeof " + type) );
47         };
48 };
49