diff --git a/www/extras/yui-ext/README.txt b/www/extras/yui-ext/README.txt
deleted file mode 100644
index 7936cdf33..000000000
--- a/www/extras/yui-ext/README.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-yui-ext.js includes the entire library.
-
-All other files in this directory depend on yui-ext-core.js.
-
-editor-grid-lib.js includes everything in basic-grid-lib.js AND editing support. basic-grid-lib.js is NOT required for editor-grid-lib.js.
-
-If you have the JS Builder, you can create your own output files using yui-ext.jsb.
-
diff --git a/www/extras/yui-ext/animator-lib.js b/www/extras/yui-ext/animator-lib.js
deleted file mode 100644
index 011d123c6..000000000
--- a/www/extras/yui-ext/animator-lib.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-
-YAHOO.ext.Actor=function(element,animator,selfCapture){YAHOO.ext.Actor.superclass.constructor.call(this,element,true);this.el=YAHOO.ext.Element.get(this.id);this.onCapture=new YAHOO.util.CustomEvent('Actor.onCapture');if(animator){animator.addActor(this);}
-this.capturing=selfCapture;this.playlist=selfCapture?new YAHOO.ext.Animator.AnimSequence():null;};YAHOO.extendX(YAHOO.ext.Actor,YAHOO.ext.Element);YAHOO.ext.Actor.prototype.capture=function(action){if(this.playlist!=null){this.playlist.add(action);}
-this.onCapture.fireDirect(this,action);return action;};YAHOO.ext.Actor.overrideAnimation=function(method,animParam,onParam){return function(){if(!this.capturing){return method.apply(this,arguments);}
-var args=Array.prototype.slice.call(arguments,0);if(args[animParam]===true){return this.capture(new YAHOO.ext.Actor.AsyncAction(this,method,args,onParam));}else{return this.capture(new YAHOO.ext.Actor.Action(this,method,args));}};}
-YAHOO.ext.Actor.overrideBasic=function(method){return function(){if(!this.capturing){return method.apply(this,arguments);}
-var args=Array.prototype.slice.call(arguments,0);return this.capture(new YAHOO.ext.Actor.Action(this,method,args));};}
-YAHOO.ext.Actor.prototype.setVisibilityMode=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setVisibilityMode);YAHOO.ext.Actor.prototype.enableDisplayMode=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.enableDisplayMode);YAHOO.ext.Actor.prototype.focus=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.focus);YAHOO.ext.Actor.prototype.addClass=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.addClass);YAHOO.ext.Actor.prototype.removeClass=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.removeClass);YAHOO.ext.Actor.prototype.replaceClass=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.replaceClass);YAHOO.ext.Actor.prototype.setStyle=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setStyle);YAHOO.ext.Actor.prototype.setX=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setX);YAHOO.ext.Actor.prototype.setY=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setY);YAHOO.ext.Actor.prototype.setLeft=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setLeft);YAHOO.ext.Actor.prototype.setTop=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setTop);YAHOO.ext.Actor.prototype.setAbsolutePositioned=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setAbsolutePositioned);YAHOO.ext.Actor.prototype.setRelativePositioned=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setRelativePositioned);YAHOO.ext.Actor.prototype.clearPositioning=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clearPositioning);YAHOO.ext.Actor.prototype.setPositioning=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setPositioning);YAHOO.ext.Actor.prototype.clip=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clip);YAHOO.ext.Actor.prototype.unclip=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.unclip);YAHOO.ext.Actor.prototype.clearOpacity=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clearOpacity);YAHOO.ext.Actor.prototype.update=YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.update);YAHOO.ext.Actor.prototype.animate=function(args,duration,onComplete,easing,animType){if(!this.capturing){return YAHOO.ext.Actor.superclass.animate.apply(this,arguments);}
-return this.capture(new YAHOO.ext.Actor.AsyncAction(this,YAHOO.ext.Actor.superclass.animate,[args,duration,onComplete,easing,animType],2));};YAHOO.ext.Actor.prototype.setVisible=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setVisible,1,3);YAHOO.ext.Actor.prototype.toggle=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.toggle,0,2);YAHOO.ext.Actor.prototype.setXY=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setXY,1,3);YAHOO.ext.Actor.prototype.setLocation=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setLocation,2,4);YAHOO.ext.Actor.prototype.setWidth=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setWidth,1,3);YAHOO.ext.Actor.prototype.setHeight=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setHeight,1,3);YAHOO.ext.Actor.prototype.setSize=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setSize,2,4);YAHOO.ext.Actor.prototype.setBounds=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setBounds,4,6);YAHOO.ext.Actor.prototype.setOpacity=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setHeight,1,3);YAHOO.ext.Actor.prototype.moveTo=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.moveTo,2,4);YAHOO.ext.Actor.prototype.move=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.move,2,4);YAHOO.ext.Actor.prototype.alignTo=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.alignTo,3,5);YAHOO.ext.Actor.prototype.hide=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.hide,0,2);YAHOO.ext.Actor.prototype.show=YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.show,0,2);YAHOO.ext.Actor.prototype.startCapture=function(){this.capturing=true;this.playlist=new YAHOO.ext.Animator.AnimSequence();};YAHOO.ext.Actor.prototype.stopCapture=function(){this.capturing=false;};YAHOO.ext.Actor.prototype.clear=function(){this.playlist=new YAHOO.ext.Animator.AnimSequence();};YAHOO.ext.Actor.prototype.play=function(oncomplete){this.capturing=false;if(this.playlist){this.playlist.play(oncomplete);}};YAHOO.ext.Actor.prototype.addCall=function(fcn,args,scope){this.capture(new YAHOO.ext.Actor.Action(scope,fcn,args||[]));};YAHOO.ext.Actor.prototype.addAsyncCall=function(fcn,callbackIndex,args,scope){this.capture(new YAHOO.ext.Actor.AsyncAction(scope,fcn,args||[],callbackIndex));},YAHOO.ext.Actor.prototype.pause=function(seconds){this.capture(new YAHOO.ext.Actor.PauseAction(seconds));};YAHOO.ext.Actor.prototype.shake=function(){this.move('left',20,true,.05);this.move('right',40,true,.05);this.move('left',40,true,.05);this.move('right',20,true,.05);};YAHOO.ext.Actor.prototype.bounce=function(){this.move('up',20,true,.05);this.move('down',40,true,.05);this.move('up',40,true,.05);this.move('down',20,true,.05);};YAHOO.ext.Actor.prototype.blindShow=function(anchor,newSize,duration,easing){var size=newSize||this.getSize();this.clip();this.setVisible(true);anchor=anchor.toLowerCase();switch(anchor){case't':case'top':this.setHeight(1);this.setHeight(newSize,true,duration||.5,null,easing||YAHOO.util.Easing.easeOut);break;case'l':case'left':this.setWidth(1);this.setWidth(newSize,true,duration||.5,null,easing||YAHOO.util.Easing.easeOut);break;}
-this.unclip();return size;};YAHOO.ext.Actor.prototype.blindHide=function(anchor,duration,easing){var size=this.getSize();this.clip();anchor=anchor.toLowerCase();switch(anchor){case't':case'top':this.setSize(size.width,1,true,duration||.5,null,easing||YAHOO.util.Easing.easeIn);this.setVisible(false);break;case'l':case'left':this.setSize(1,size.height,true,duration||.5,null,easing||YAHOO.util.Easing.easeIn);this.setVisible(false);break;case'r':case'right':this.animate({width:{to:1},points:{by:[this.getWidth(),0]}},duration||.5,null,YAHOO.util.Easing.easeIn,YAHOO.util.Motion);this.setVisible(false);break;case'b':case'bottom':this.animate({height:{to:1},points:{by:[0,this.getHeight()]}},duration||.5,null,YAHOO.util.Easing.easeIn,YAHOO.util.Motion);this.setVisible(false);break;}
-return size;};YAHOO.ext.Actor.prototype.slideShow=function(anchor,newSize,duration,easing){var size=newSize||this.getSize();this.clip();var firstChild=this.dom.firstChild;if(!firstChild||(firstChild.nodeName&&"#TEXT"==firstChild.nodeName.toUpperCase())){this.blindShow(anchor,newSize,duration,easing);return;}
-var child=YAHOO.ext.Element.get(firstChild,true);var pos=child.getPositioning();this.addCall(child.setAbsolutePositioned,null,child);this.setVisible(true);anchor=anchor.toLowerCase();switch(anchor){case't':case'top':this.addCall(child.setStyle,['left','0px'],child);this.addCall(child.setStyle,['bottom','0px'],child);this.setHeight(1);this.setHeight(newSize,true,duration||.5,null,easing||YAHOO.util.Easing.easeOut);break;case'l':case'left':this.addCall(child.setStyle,['right','0px'],child);this.addCall(child.setStyle,['top','0px'],child);this.setWidth(1);this.setWidth(newSize,true,duration||.5,null,easing||YAHOO.util.Easing.easeOut);break;}
-this.addCall(child.setPositioning,[pos],child);this.unclip();return size;};YAHOO.ext.Actor.prototype.slideHide=function(anchor,duration,easing){var size=this.getSize();this.clip();var firstChild=this.dom.firstChild;if(!firstChild||(firstChild.nodeName&&"#TEXT"==firstChild.nodeName.toUpperCase())){this.blindHide(anchor,duration,easing);return;}
-var child=YAHOO.ext.Element.get(firstChild,true);var pos=child.getPositioning();this.addCall(child.setAbsolutePositioned,null,child);anchor=anchor.toLowerCase();switch(anchor){case't':case'top':this.addCall(child.setStyle,['left','0px'],child);this.addCall(child.setStyle,['bottom','0px'],child);this.setSize(size.width,1,true,duration||.5,null,easing||YAHOO.util.Easing.easeIn);this.setVisible(false);break;case'l':case'left':this.addCall(child.setStyle,['right','0px'],child);this.addCall(child.setStyle,['top','0px'],child);this.setSize(1,size.height,true,duration||.5,null,easing||YAHOO.util.Easing.easeIn);this.setVisible(false);break;case'r':case'right':this.addCall(child.setStyle,['left','0px'],child);this.addCall(child.setStyle,['top','0px'],child);this.animate({width:{to:1},points:{by:[this.getWidth(),0]}},duration||.5,null,YAHOO.util.Easing.easeIn,YAHOO.util.Motion);this.setVisible(false);break;case'b':case'bottom':this.addCall(child.setStyle,['left','0px'],child);this.addCall(child.setStyle,['bottom','0px'],child);this.animate({height:{to:1},points:{by:[0,this.getHeight()]}},duration||.5,null,YAHOO.util.Easing.easeIn,YAHOO.util.Motion);this.setVisible(false);break;}
-this.addCall(child.setPositioning,[pos],child);return size;};YAHOO.ext.Actor.prototype.squish=function(duration){var size=this.getSize();this.clip();this.setSize(1,1,true,duration||.5);this.setVisible(false);return size;};YAHOO.ext.Actor.prototype.appear=function(duration){this.setVisible(true,true,duration);};YAHOO.ext.Actor.prototype.fade=function(duration){this.setVisible(false,true,duration);};YAHOO.ext.Actor.prototype.switchOff=function(duration){this.clip();this.setVisible(false,true,.1);this.clearOpacity();this.setVisible(true);this.animate({height:{to:1},points:{by:[0,this.getHeight()/2]}},duration||.5,null,YAHOO.util.Easing.easeOut,YAHOO.util.Motion);this.setVisible(false);};YAHOO.ext.Actor.prototype.highlight=function(color,fromColor,duration,attribute){attribute=attribute||'backgroundColor';var original=this.getStyle(attribute);fromColor=fromColor||((original&&original!=''&&original!='transparent')?original:'#FFFFFF');var cfg={};cfg[attribute]={to:color,from:fromColor};this.setVisible(true);this.animate(cfg,duration||.5,null,YAHOO.util.Easing.bounceOut,YAHOO.util.ColorAnim);this.setStyle(attribute,original);};YAHOO.ext.Actor.prototype.pulsate=function(count,duration){count=count||3;for(var i=0;i
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- '}]});htemplate.compile();for(var i=0;i{1} '+''+' '}]});htemplate.compile();for(var i=0;i{1} '+''+' Class Date
-Object
- |
- +--Date
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Summary
-
-
-
-
- Object
- format
-
- Same as dateFormat()
-
-
-
-
- <static> Object
- dayNames
-
- Override these values for international dates, for example...
-
-
-
-
-
- <static> Object
- monthNames
-
- Override these values for international dates, for example...
-
-
-
-
-
-
-
-
-
- Method Summary
-
- * Parameter types in italic indicate optional parameters
-
-
-
-
-
-
-
-
- Object
-
-
-
-
-
- dateFormat(format)
-
-
-
- Formats a date given to the supplied format - the format syntax is the same as PHP's date() function.
-
-
-
-
-
-
- Object
-
-
-
-
-
- getDayOfYear()
-
-
-
-
-
-
-
-
-
-
- Object
-
-
-
-
-
- getDaysInMonth()
-
-
-
-
-
-
-
-
-
-
- Object
-
-
-
-
-
- getFirstDayOfMonth()
-
-
-
-
-
-
-
-
-
-
- Object
-
-
-
-
-
- getGMTOffset()
-
-
-
-
-
-
-
-
-
-
- Object
-
-
-
-
-
- getLastDayOfMonth()
-
-
-
-
-
-
-
-
-
-
- Object
-
-
-
-
-
- getTimezone()
-
-
-
-
-
-
-
-
-
-
- Object
-
-
-
-
-
- getWeekOfYear()
-
-
-
-
-
-
-
-
-
-
- Object
-
-
-
-
-
- isLeapYear()
-
-
-
-
-
-
-
-
-
-
-
- <static> Object
-
-
-
-
-
- parseDate(input, format)
-
-
-
- Parses a date given the supplied format - the format syntax is the same as PHP's date() function.
-
-
-
-
-
-
-
- Field Detail
- format
- Object format
-
- Same as dateFormat()
-
-
-
-
-
- dayNames
- <static> Object dayNames
-
- Override these values for international dates, for example...
- Date.dayNames = ['SundayInYourLang', 'MondayInYourLang', ...];
-
-
-
-
-
- monthNames
- <static> Object monthNames
-
- Override these values for international dates, for example...
- Date.monthNames = ['JanInYourLang', 'FebInYourLang', ...];
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
- dateFormat
- Object dateFormat(format)
-
- Formats a date given to the supplied format - the format syntax is the same as PHP's date() function.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getDayOfYear
- Object getDayOfYear()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getDaysInMonth
- Object getDaysInMonth()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getFirstDayOfMonth
- Object getFirstDayOfMonth()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getGMTOffset
- Object getGMTOffset()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getLastDayOfMonth
- Object getLastDayOfMonth()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getTimezone
- Object getTimezone()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getWeekOfYear
- Object getWeekOfYear()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- isLeapYear
- Object isLeapYear()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- parseDate
- <static> Object parseDate(input, format)
-
- Parses a date given the supplied format - the format syntax is the same as PHP's date() function.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Class Function
-Object
- |
- +--Function
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
- * Parameter types in italic indicate optional parameters
-
-
-
-
-
-
-
-
- Function
-
-
-
-
-
- createCallback()
-
-
-
- Creates a callback that passes arguments[0], arguments[1], arguments[2], ...
-
-
-
-
-
-
- Function
-
-
-
-
-
- createDelegate(<Object> obj, <Array> args, <Boolean> appendArgs)
-
-
-
- Creates a delegate (callback) that sets the scope to obj.
-
-
-
-
-
-
- Function
-
-
-
-
-
- createInterceptor(<Function> fcn, <Object> scope)
-
-
-
- Creates an interceptor function.
-
-
-
-
-
-
-
- Function
-
-
-
-
-
- createSequence(<Function> fcn, <Object> scope)
-
-
-
- Create a combined function call sequence of the original function + the passed function.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
- createCallback
- Function createCallback()
-
- Creates a callback that passes arguments[0], arguments[1], arguments[2], ...
- Call directly on any function. Example:
-
-
-
-
-
-
-
- myFunction.createCallback(myarg, myarg2)
- Will create a function that is bound to those 2 args.
- Returns:
-
-
-
-
-
-
-
- The new function
-
-
-
-
- createDelegate
- Function createDelegate(<Object> obj, <Array> args, <Boolean> appendArgs)
-
- Creates a delegate (callback) that sets the scope to obj.
- Call directly on any function. Example:
-
-
-
-
- this.myFunction.createDelegate(this)
- Will create a function that is automatically scoped to this.
- Parameters:
-
-
-
-
-
-
-
-
- obj - The object for which the scope is set
-
-
- args - (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
-
-
- appendArgs - (optional) if True args are appended to call args instead of overriding
-
- Returns:
-
-
-
-
-
-
-
- The new function
-
-
-
-
- createInterceptor
- Function createInterceptor(<Function> fcn, <Object> scope)
-
- Creates an interceptor function. The passed fcn is called before the original one. If it returns false, the original one is not called.
- The resulting function returns the results of the original function.
- The passed fcn is called with the parameters of the original function.
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
-
-
- fcn - The function to call before the original
-
-
- scope - (optional) The scope of the passed fcn (Defaults to scope of original function or window)
-
- Returns:
-
-
-
-
-
-
-
- The new function
-
-
-
-
- createSequence
- Function createSequence(<Function> fcn, <Object> scope)
-
- Create a combined function call sequence of the original function + the passed function.
- The resulting function returns the results of the original function.
- The passed fcn is called with the parameters of the original function
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
-
-
- fcn - The function to sequence
-
-
- scope - (optional) The scope of the passed fcn (Defaults to scope of original function or window)
-
- Returns:
-
-
-
-
-
-
-
- The new function
-
-
-
-
-
-
-
-
-
-
-
-
-
-Class YAHOO.ext.Actor.Action
-Object
- |
- +--YAHOO.ext.Actor.Action
-
-
-
-
-
-
-
-
-
Used by YAHOO.ext.Actor to queue standard calls. Generally used internally. Documentation to come.
-
-
Defined in Actor.js
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Constructor Summary
-
-
-
-
-
-
-
- YAHOO.ext.Actor.Action
-
- (actor, method, args)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
- * Parameter types in italic indicate optional parameters
-
-
-
-
-
-
-
-
-
- void
-
-
-
-
-
- play(onComplete)
-
-
-
-
-
-
-
-
-
-
- Constructor Detail
-
-
-YAHOO.ext.Actor.Action
-YAHOO.ext.Actor.Action(actor, method, args)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
- play
- void play(onComplete)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Class YAHOO.ext.Actor.AsyncAction
-Object
- |
- +--YAHOO.ext.Actor.AsyncAction
-
-
-
-
-
-
-
-
-
Used by YAHOO.ext.Actor to queue animations. Generally used internally. Documentation to come.
-
-
Defined in Actor.js
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Constructor Summary
-
-
-
-
-
-
-
- YAHOO.ext.Actor.AsyncAction
-
- (actor, method, args, onIndex)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
- * Parameter types in italic indicate optional parameters
-
-
-
-
-
-
-
-
-
- void
-
-
-
-
-
- play(onComplete)
-
-
-
-
-
-
-
-
-
-
- Constructor Detail
-
-
-YAHOO.ext.Actor.AsyncAction
-YAHOO.ext.Actor.AsyncAction(actor, method, args, onIndex)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
- play
- void play(onComplete)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Class YAHOO.ext.Actor.PauseAction
-Object
- |
- +--YAHOO.ext.Actor.PauseAction
-
-
-
-
-
-
-
-
-
Used by YAHOO.ext.Actor to perform pauses. Generally used internally. Documentation to come.
-
-
Defined in Actor.js
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Constructor Summary
-
-
-
-
-
-
-
- YAHOO.ext.Actor.PauseAction
-
- (seconds)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Summary
-
- * Parameter types in italic indicate optional parameters
-
-
-
-
-
-
-
-
-
- void
-
-
-
-
-
- play(onComplete)
-
-
-
-
-
-
-
-
-
-
- Constructor Detail
-
-
-YAHOO.ext.Actor.PauseAction
-YAHOO.ext.Actor.PauseAction(seconds)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
- play
- void play(onComplete)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Class YAHOO.ext.Actor
-Object
- |
- +--YAHOO.ext.Element
- |
- +--YAHOO.ext.Actor
-
-
-
-
-
-
-
-
-
Provides support for syncing and chaining of Element Yahoo! UI based animation and some common effects. Actors support "self-play" without an Animator.
- Note: Along with the animation methods defined below, this class inherits and captures all of the "set" or animation methods of YAHOO.ext.Element. "get" methods are not captured and execute immediately.
-
Usage:
-
-
- var actor = new YAHOO.ext.Actor('myElementId');
- actor.startCapture(true);
- actor.moveTo(100, 100, true);
- actor.squish();
- actor.play();
-
- // or to start capturing immediately, with no Animator (the null second param)
-
- var actor = new YAHOO.ext.Actor('myElementId', null, true);
- actor.moveTo(100, 100, true);
- actor.squish();
- actor.play();
-
Defined in Actor.js
Requires:- YAHOO.ext.Element
-
- YAHOO.util.Dom
- YAHOO.util.Event
- YAHOO.util.CustomEvent
- YAHOO.util.Anim
- YAHOO.util.ColorAnim
- YAHOO.util.Motion
| Nested Class Summary | -|
- <static class> |
- YAHOO.ext.Actor.Action |
-
- <static class> |
- YAHOO.ext.Actor.AsyncAction |
-
- <static class> |
- YAHOO.ext.Actor.PauseAction |
-
| Field Summary | |
- Function |
- addClass
- - Capturing override - See YAHOO.ext.Element.addClass() for method details. |
-
- Function |
- alignTo
- - Capturing and animation syncing override - See YAHOO.ext.Element.alignTo() for method details. |
-
- Object |
- capturing
- - Whether this actor is currently capturing |
-
- Function |
- clearOpacity
- - Capturing override - See YAHOO.ext.Element.clearOpacity() for method details. |
-
- Function |
- clearPositioning
- - Capturing override - See YAHOO.ext.Element.clearPositioning() for method details. |
-
- Function |
- clip
- - Capturing override - See YAHOO.ext.Element.clip() for method details. |
-
- Object |
- el
- - |
-
- Function |
- enableDisplayMode
- - Capturing override - See YAHOO.ext.Element.enableDisplayMode() for method details. |
-
- Function |
- focus
- - Capturing override - See YAHOO.ext.Element.focus() for method details. |
-
- Function |
- hide
- - Capturing and animation syncing override - See YAHOO.ext.Element.hide() for method details. |
-
- Function |
- move
- - Capturing and animation syncing override - See YAHOO.ext.Element.move() for method details. |
-
- Function |
- moveTo
- - Capturing and animation syncing override - See YAHOO.ext.Element.moveTo() for method details. |
-
- Object |
- onCapture
- - |
-
- Object |
- playlist
- - |
-
- Function |
- removeClass
- - Capturing override - See YAHOO.ext.Element.removeClass() for method details. |
-
- Function |
- replaceClass
- - Capturing override - See YAHOO.ext.Element.replaceClass() for method details. |
-
- Function |
- setAbsolutePositioned
- - Capturing override - See YAHOO.ext.Element.setAbsolutePositioned() for method details. |
-
- Function |
- setBounds
- - Capturing and animation syncing override - See YAHOO.ext.Element.setBounds() for method details. |
-
- Function |
- setHeight
- - Capturing and animation syncing override - See YAHOO.ext.Element.setHeight() for method details. |
-
- Function |
- setLeft
- - Capturing override - See YAHOO.ext.Element.setLeft() for method details. |
-
- Function |
- setLocation
- - Capturing and animation syncing override - See YAHOO.ext.Element.setLocation() for method details. |
-
- Function |
- setOpacity
- - Capturing and animation syncing override - See YAHOO.ext.Element.setHeight() for method details. |
-
- Function |
- setPositioning
- - Capturing override - See YAHOO.ext.Element.setPositioning() for method details. |
-
- Function |
- setRelativePositioned
- - Capturing override - See YAHOO.ext.Element.setRelativePositioned() for method details. |
-
- Function |
- setSize
- - Capturing and animation syncing override - See YAHOO.ext.Element.setSize() for method details. |
-
- Function |
- setStyle
- - Capturing override - See YAHOO.ext.Element.setStyle() for method details. |
-
- Function |
- setTop
- - Capturing override - See YAHOO.ext.Element.setTop() for method details. |
-
- Function |
- setVisibilityMode
- - Capturing override - See YAHOO.ext.Element.setVisibilityMode() for method details. |
-
- Function |
- setVisible
- - Capturing and animation syncing override - See YAHOO.ext.Element.setVisible() for method details. |
-
- Function |
- setWidth
- - Capturing and animation syncing override - See YAHOO.ext.Element.setWidth() for method details. |
-
- Function |
- setX
- - Capturing override - See YAHOO.ext.Element.setX() for method details. |
-
- Function |
- setXY
- - Capturing and animation syncing override - See YAHOO.ext.Element.setXY() for method details. |
-
- Function |
- setY
- - Capturing override - See YAHOO.ext.Element.setY() for method details. |
-
- Function |
- show
- - Capturing and animation syncing override - See YAHOO.ext.Element.show() for method details. |
-
- Function |
- toggle
- - Capturing and animation syncing override - See YAHOO.ext.Element.toggle() for method details. |
-
- Function |
- unclip
- - Capturing override - See YAHOO.ext.Element.unclip() for method details. |
-
- Function |
- update
- - Capturing override - See YAHOO.ext.Element.clearOpacity() for method details. |
-
| Fields inherited from class YAHOO.ext.Element | -
- id, defaultUnit, onVisibilityChanged, onMoved, onResized, autoBoxAdjust
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.Actor
-
- (element, <YAHOO.ext.Animator> animator, <Boolean> selfCapture)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- addAsyncCall(<Function> fcn, <Number> callbackIndex, <Array> args, <Object> scope)
-
- - - Capture an async function call. - |
-
-
- void
-
- |
-
-
-
- addCall(<Function> fcn, <Array> args, <Object> scope)
-
- - - Capture a function call. - |
-
-
- Function
-
- |
-
-
-
- animate(args, duration, onComplete, easing, animType)
-
- - - Capturing and animation syncing override - See YAHOO.ext.Element.animate() for method details. - |
-
-
- void
-
- |
-
-
-
- appear(<Float> duration)
-
- - - Fade an element in - |
-
-
- Object
-
- |
-
-
-
- blindHide(<String> anchor, <Float> duration, <Function> easing)
-
- - - Hide the element using a "blinds" effect - |
-
-
- Object
-
- |
-
-
-
- blindShow(<String> anchor, <Number> newSize, <Float> duration, <Function> easing)
-
- - - Show the element using a "blinds" effect - |
-
-
- void
-
- |
-
-
-
- bounce()
-
- - - Bounce this element from up and down - |
-
-
- Object
-
- |
-
-
-
- capture(<YAHOO.ext.Actor.Action> action)
-
- - - Captures an action for this actor. - |
-
-
- void
-
- |
-
-
-
- clear()
-
- - - Clears any calls that have been self captured. - |
-
-
- void
-
- |
-
-
-
- dropOut(<Float> duration)
-
- - - Fade the element as it is falling from it's current position - |
-
-
- void
-
- |
-
-
-
- fade(<Float> duration)
-
- - - Fade an element out - |
-
-
- void
-
- |
-
-
-
- highlight(<String> color, <String> fromColor, <Float> duration, <String> attribute)
-
- - - Highlight the element using a background color (or passed attribute) animation - |
-
-
- void
-
- |
-
-
-
- moveIn(<String> anchor, <Array> to, <Float> duration, <Function> easing)
-
- - - Show the element in a way that it appears as if it is flying onto the screen - |
-
-
- void
-
- |
-
-
-
- moveOut(<String> anchor, <Float> duration, <Function> easing)
-
- - - Hide the element in a way that it appears as if it is flying off the screen - |
-
-
- void
-
- |
-
-
-
- pause(<Number> seconds)
-
- - - Capture a pause (in seconds). - |
-
-
- void
-
- |
-
-
-
- play(<Function> oncomplete)
-
- - - Starts playback of self captured calls. - |
-
-
- void
-
- |
-
-
-
- pulsate(<Number> count, <Float> duration)
-
- - - Fade the element in and out the specified amount of times - |
-
-
- void
-
- |
-
-
-
- shake()
-
- - - Shake this element from side to side - |
-
-
- Object
-
- |
-
-
-
- slideHide(<String> anchor, <Float> duration, <Function> easing)
-
- - - Hide the element using a "slide in" effect - In order for this effect to work the element MUST have a child element container that can be "slid" otherwise a blindHide effect is rendered. - |
-
-
- Object
-
- |
-
-
-
- slideShow(<String> anchor, <Number> newSize, <Float> duration, <Function> easing)
-
- - - Show the element using a "slide in" effect - In order for this effect to work the element MUST have a child element container that can be "slid" otherwise a blindShow effect is rendered. - |
-
-
- Object
-
- |
-
-
-
- squish(<Float> duration)
-
- - - Hide the element by "squishing" it into the corner - |
-
-
- void
-
- |
-
-
-
- startCapture()
-
- - - Start self capturing calls on this Actor. - |
-
-
- void
-
- |
-
-
-
- stopCapture()
-
- - - Stop self capturing calls on this Actor. - |
-
-
- void
-
- |
-
-
-
- switchOff(<Float> duration)
-
- - - Blink the element as if it was clicked and then collapse on it's center - |
-
| Methods inherited from class YAHOO.ext.Element | -
-
-setVisibilityMode, enableDisplayMode, isVisible, setVisible, toggle, focus, addClass, radioClass, removeClass, toggleClass, hasClass, replaceClass, getStyle, setStyle, getX, getY, getXY, setX, setY, setLeft, setTop, setRight, setBottom, setXY, setLocation, moveTo, getRegion, getHeight, getWidth, getSize, setWidth, setHeight, setSize, setBounds, setRegion, addListener, addHandler, on, addManagedListener, mon, removeListener, removeAllListeners, setOpacity, getLeft, getRight, getTop, getBottom, setAbsolutePositioned, setRelativePositioned, clearPositioning, getPositioning, getBorderWidth, getPadding, setPositioning, move, clip, unclip, alignTo, clearOpacity, hide, show, beginMeasure, endMeasure, update, getUpdateManager, getCenterXY, getChildrenByTagName, getChildrenByClassName, isBorderBox, getBox, setBox
- |
-
| Field Detail | -
Function addClass-
Function alignTo-
Object capturing-
Function clearOpacity-
Function clearPositioning-
Function clip-
Object el-
Function enableDisplayMode-
Function focus-
Function hide-
Function move-
Function moveTo-
Object onCapture-
Object playlist-
Function removeClass-
Function replaceClass-
Function setAbsolutePositioned-
Function setBounds-
Function setHeight-
Function setLeft-
Function setLocation-
Function setOpacity-
Function setPositioning-
Function setRelativePositioned-
Function setSize-
Function setStyle-
Function setTop-
Function setVisibilityMode-
Function setVisible-
Function setWidth-
Function setX-
Function setXY-
Function setY-
Function show-
Function toggle-
Function unclip-
Function update-
| - Constructor Detail - | -
YAHOO.ext.Actor(element, <YAHOO.ext.Animator> animator, <Boolean> selfCapture)- - - - -
animator - (optional) The Animator that will capture this Actor's actions
- selfCapture - (optional) Whether this actor should capture it's own actions to support self playback without an animator (defaults to false)
- el - The dom element or element id
- | - Method Detail - | -
void addAsyncCall(<Function> fcn, <Number> callbackIndex, <Array> args, <Object> scope)- -
fcn - The function to call
- callbackIndex - The index of the callback parameter on the passed function. A CALLBACK IS REQUIRED.
- args - The arguments to call the function with
- scope - (optional) The scope of the function
- void addCall(<Function> fcn, <Array> args, <Object> scope)- -
fcn - The function to call
- args - (optional) The arguments to call the function with
- scope - (optional) The scope of the function
- Function animate(args, duration, onComplete, easing, animType)- -
void appear(<Float> duration)- -
duration - (optional) How long the effect lasts (in seconds)
- Object blindHide(<String> anchor, <Float> duration, <Function> easing)- -
anchor - The part of the element that it should appear to collapse to. The short/long options are t/top, l/left, b/bottom, r/right.
- duration - (optional) How long the effect lasts (in seconds)
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn)
- Object blindShow(<String> anchor, <Number> newSize, <Float> duration, <Function> easing)- -
anchor - The part of the element that it should appear to exapand from. The short/long options currently are t/top, l/left
- newSize - (optional) The size to animate to. (Default to current size)
- duration - (optional) How long the effect lasts (in seconds)
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut)
- void bounce()- -
Object capture(<YAHOO.ext.Actor.Action> action)- -
action -
- void clear()- -
void dropOut(<Float> duration)- -
duration - (optional) How long the effect lasts (in seconds)
- void fade(<Float> duration)- -
duration - (optional) How long the effect lasts (in seconds)
- void highlight(<String> color, <String> fromColor, <Float> duration, <String> attribute)- -
color - (optional) The color to use for the highlight
- fromColor - (optional) If the element does not currently have a background color, you will need to pass in a color to animate from
- duration - (optional) How long the effect lasts (in seconds)
- attribute - (optional) Specify a CSS attribute to use other than background color - camelCase
- void moveIn(<String> anchor, <Array> to, <Float> duration, <Function> easing)- -
anchor - The part of the page that the element should appear to move from. The short/long options are t/top, l/left, b/bottom, r/right, tl/top-left, tr/top-right, bl/bottom-left or br/bottom-right.
- to - (optional) Array of x and y position to move to like [x, y] (Defaults to center screen)
- duration - (optional) How long the effect lasts (in seconds)
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut)
- void moveOut(<String> anchor, <Float> duration, <Function> easing)- -
anchor - The part of the page that the element should appear to move to. The short/long options are t/top, l/left, b/bottom, r/right, tl/top-left, tr/top-right, bl/bottom-left or br/bottom-right.
- duration - (optional) How long the effect lasts (in seconds)
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn)
- void pause(<Number> seconds)- -
seconds - The seconds to pause
- void play(<Function> oncomplete)- -
oncomplete - (optional) Callback to execute when playback has completed
- void pulsate(<Number> count, <Float> duration)- -
count - (optional) How many times to pulse (Defaults to 3)
- duration - (optional) How long the effect lasts (in seconds)
- void shake()- -
Object slideHide(<String> anchor, <Float> duration, <Function> easing)- -
anchor - The part of the element that it should appear to slide to. The short/long options are t/top, l/left, b/bottom, r/right.
- duration - (optional) How long the effect lasts (in seconds)
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn)
- Object slideShow(<String> anchor, <Number> newSize, <Float> duration, <Function> easing)- -
anchor - The part of the element that it should appear to slide from. The short/long options currently are t/top, l/left
- newSize - (optional) The size to animate to. (Default to current size)
- duration - (optional) How long the effect lasts (in seconds)
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOuth)
- Object squish(<Float> duration)- -
duration - (optional) How long the effect lasts (in seconds)
- void startCapture()- -
void stopCapture()- -
void switchOff(<Float> duration)- -
duration - (optional) How long the effect lasts (in seconds)
- Object - | - +--YAHOO.ext.Animator.AnimSequence -- - -
-
Used by YAHOO.ext.Animator to sequence animations. Generally used internally. Documentation to come.
-
-
Defined in Animator.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.Animator.AnimSequence
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- add(action)
-
- - - - |
-
-
- void
-
- |
-
-
-
- addAsyncCall(<Function> fcn, <Number> callbackIndex, <Array> args, <Object> scope)
-
- - - Add an async function call to the capture queue. - |
-
-
- void
-
- |
-
-
-
- addCall(fcn, args, scope)
-
- - - - |
-
-
- void
-
- |
-
-
-
- clear()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- isPlaying()
-
- - - - |
-
-
- void
-
- |
-
-
-
- next()
-
- - - - |
-
-
- void
-
- |
-
-
-
- pause(seconds)
-
- - - - |
-
-
- void
-
- |
-
-
-
- play(oncomplete)
-
- - - - |
-
-
- void
-
- |
-
-
-
- stop()
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.Animator.AnimSequence()- - - - - - - - - - - - - -
| - Method Detail - | -
void add(action)- - - - - - - - - - - -
void addAsyncCall(<Function> fcn, <Number> callbackIndex, <Array> args, <Object> scope)- -
fcn - The function to call
- callbackIndex - The index of the callback parameter on the passed function. A CALLBACK IS REQUIRED.
- args - The arguments to call the function with
- scope - (optional) The scope of the function
- void addCall(fcn, args, scope)- - - - - - - - - - - -
void clear()- - - - - - - - - - - -
Object isPlaying()- - - - - - - - - - - -
void next()- - - - - - - - - - - -
void pause(seconds)- - - - - - - - - - - -
void play(oncomplete)- - - - - - - - - - - -
void stop()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.Animator.CompositeSequence -- - -
-
Used by YAHOO.ext.Animator to run multiple animation sequences at once. Generally used internally. Documentation to come.
-
-
Defined in Animator.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.Animator.CompositeSequence
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- add(sequence)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- isPlaying()
-
- - - - |
-
-
- void
-
- |
-
-
-
- play(onComplete)
-
- - - - |
-
-
- void
-
- |
-
-
-
- stop()
-
- - - - |
-
-
- void
-
- |
-
-
-
- trackCompletion()
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.Animator.CompositeSequence()- - - - - - - - - - - - - -
| - Method Detail - | -
void add(sequence)- - - - - - - - - - - -
Object isPlaying()- - - - - - - - - - - -
void play(onComplete)- - - - - - - - - - - -
void stop()- - - - - - - - - - - -
void trackCompletion()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.Element - | - +--YAHOO.ext.Animator -- - -
-
Provides support for syncing animations for multiple YAHOO.ext.Actors.
-
This example can be seen in action here by clicking on "Click here and I will point it out".
-
-var animator = new YAHOO.ext.Animator();
-var cursor = new YAHOO.ext.Actor('cursor-img', animator);
-var click = new YAHOO.ext.Actor('click-img', animator);
-var resize = new YAHOO.ext.Actor('resize-img', animator);
-
-// start capturing
-animator.startCapture();
-
-// these animations will be run in sequence
-cursor.show();
-cursor.moveTo(500,400);
-cursor.moveTo(20, getEl('navbar').getY()+10, true, .75);
-click.show();
-click.alignTo(cursor, 'tl', [-4, -4]);
-
-// Add an async function call, pass callback to argument 1
-animator.addAsyncCall(Blog.navbar.undockDelegate, 1);
-
-// pause .5 seconds
-animator.pause(.5);
-
-// again, these animations will be run in sequence
-click.hide(true, .7);
-cursor.alignTo('splitter', 'tr', [0, +100], true, 1);
-resize.alignTo('splitter', 'tr', [-12, +100]);
-
-// start sync block: these animations will run at the same time
-animator.beginSync();
-cursor.hide();
-resize.show();
-animator.endSync();
-
-// play the captured animation sequences, call myCallback when done
-animator.play(myCallback);
-
- | Nested Class Summary | -|
- <static class> |
- YAHOO.ext.Animator.AnimSequence |
-
- <static class> |
- YAHOO.ext.Animator.CompositeSequence |
-
| Fields inherited from class YAHOO.ext.Element | -
- id, defaultUnit, onVisibilityChanged, onMoved, onResized, autoBoxAdjust
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.Animator
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- addActor(<YAHOO.ext.Actor> actor)
-
- - - Add an actor. - |
-
-
- void
-
- |
-
-
-
- addAsyncCall(<Function> fcn, <Number> callbackIndex, <Array> args, <Object> scope)
-
- - - Add an async function call to the playlist. - |
-
-
- void
-
- |
-
-
-
- addCall(<Function> fcn, <Array> args, <Object> scope)
-
- - - Add a function call to the playlist. - |
-
-
- void
-
- |
-
-
-
- beginSync()
-
- - - Start a multi-actor sync block. - |
-
-
- void
-
- |
-
-
-
- clear()
-
- - - Clear the playlist - |
-
-
- void
-
- |
-
-
-
- endSync()
-
- - - End the multi-actor sync block - |
-
-
- Object
-
- |
-
-
-
- isCapturing(<YAHOO.ext.Actor> actor)
-
- - - Checks whether this animator is listening to a specific actor. - |
-
-
- Object
-
- |
-
-
-
- isPlaying()
-
- - - Check if this animator is currently playing - |
-
-
- void
-
- |
-
-
-
- pause(<Number> seconds)
-
- - - Add a pause to the playlist (in seconds) - |
-
-
- void
-
- |
-
-
-
- play(<Function> oncomplete)
-
- - - Starts playback of the playlist, also stops any capturing. - |
-
-
- void
-
- |
-
-
-
- startCapture(<Boolean> clearPlaylist)
-
- - - Start capturing actions on the added actors. - |
-
-
- void
-
- |
-
-
-
- stop()
-
- - - Stop at the next available stopping point - |
-
-
- void
-
- |
-
-
-
- stopCapture()
-
- - - Stop capturing on all added actors. - |
-
| Methods inherited from class YAHOO.ext.Element | -
-
-setVisibilityMode, enableDisplayMode, animate, isVisible, setVisible, toggle, focus, addClass, radioClass, removeClass, toggleClass, hasClass, replaceClass, getStyle, setStyle, getX, getY, getXY, setX, setY, setLeft, setTop, setRight, setBottom, setXY, setLocation, moveTo, getRegion, getHeight, getWidth, getSize, setWidth, setHeight, setSize, setBounds, setRegion, addListener, addHandler, on, addManagedListener, mon, removeListener, removeAllListeners, setOpacity, getLeft, getRight, getTop, getBottom, setAbsolutePositioned, setRelativePositioned, clearPositioning, getPositioning, getBorderWidth, getPadding, setPositioning, move, clip, unclip, alignTo, clearOpacity, hide, show, beginMeasure, endMeasure, update, getUpdateManager, getCenterXY, getChildrenByTagName, getChildrenByClassName, isBorderBox, getBox, setBox
- |
-
| - Constructor Detail - | -
YAHOO.ext.Animator()- - - - -
el - The dom element or element id
- animator - (optional) The Animator that will capture this Actor's actions
- selfCapture - (optional) Whether this actor should capture it's own actions to support self playback without an animator (defaults to false)
- | - Method Detail - | -
void addActor(<YAHOO.ext.Actor> actor)- -
actor -
- void addAsyncCall(<Function> fcn, <Number> callbackIndex, <Array> args, <Object> scope)- -
fcn - The function to call
- callbackIndex - The index of the callback parameter on the passed function. A CALLBACK IS REQUIRED.
- args - The arguments to call the function with
- scope - (optional) The scope of the function
- void addCall(<Function> fcn, <Array> args, <Object> scope)- -
fcn - The function to call
- args - The arguments to call the function with
- scope - (optional) The scope of the function
- void beginSync()- -
void clear()- -
void endSync()- -
Object isCapturing(<YAHOO.ext.Actor> actor)- -
actor -
- Object isPlaying()- -
void pause(<Number> seconds)- -
seconds - The number of seconds to pause.
- void play(<Function> oncomplete)- -
oncomplete - (optional) Callback to execute when playback has completed
- void startCapture(<Boolean> clearPlaylist)- -
clearPlaylist - Whether to also create a new playlist
- void stop()- -
void stopCapture()- -
Object - | - +--YAHOO.ext.DatePicker -- - -
- Defined in DatePicker.js
-
| Field Summary | |
- Object |
- dayNames
- - |
-
- Object |
- disabledDatesRE
- - |
-
- Object |
- disabledDatesText
- - |
-
- Object |
- disabledDays
- - |
-
- Object |
- disabledDaysText
- - |
-
- Object |
- format
- - |
-
- Object |
- maxDate
- - |
-
- Object |
- maxText
- - |
-
- Object |
- minDate
- - |
-
- Object |
- minText
- - |
-
- Object |
- monthNames
- - |
-
- Object |
- todayText
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.DatePicker
-
- (id, parentElement)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- buildInnerCal(dateVal)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- clearTime(date)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getDaysInMonth(m, y)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getNextMonth(d)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getPrevMonth(d)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getSelectedDate()
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleClick(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleKeyDown(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleMouseDown(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleMouseWheel(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleSelection(date)
-
- - - - |
-
-
- void
-
- |
-
-
-
- hide()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- isLeapYear(y)
-
- - - - |
-
-
- void
-
- |
-
-
-
- refresh()
-
- - - - |
-
-
- void
-
- |
-
-
-
- selectToday()
-
- - - - |
-
-
- void
-
- |
-
-
-
- setSelectedDate(date)
-
- - - - |
-
-
- void
-
- |
-
-
-
- show(x, y, value, callback)
-
- - - - |
-
-
- void
-
- |
-
-
-
- showNextMonth()
-
- - - - |
-
-
- void
-
- |
-
-
-
- showNextYear()
-
- - - - |
-
-
- void
-
- |
-
-
-
- showPrevMonth()
-
- - - - |
-
-
- void
-
- |
-
-
-
- showPrevYear()
-
- - - - |
-
| Field Detail | -
Object dayNames-
Object disabledDatesRE-
Object disabledDatesText-
Object disabledDays-
Object disabledDaysText-
Object format-
Object maxDate-
Object maxText-
Object minDate-
Object minText-
Object monthNames-
Object todayText-
| - Constructor Detail - | -
YAHOO.ext.DatePicker(id, parentElement)- - - - - - - - - - - - - -
| - Method Detail - | -
void buildInnerCal(dateVal)- - - - - - - - - - - -
Object clearTime(date)- - - - - - - - - - - -
Object getDaysInMonth(m, y)- - - - - - - - - - - -
Object getNextMonth(d)- - - - - - - - - - - -
Object getPrevMonth(d)- - - - - - - - - - - -
Object getSelectedDate()- - - - - - - - - - - -
void handleClick(e)- - - - - - - - - - - -
void handleKeyDown(e)- - - - - - - - - - - -
void handleMouseDown(e)- - - - - - - - - - - -
void handleMouseWheel(e)- - - - - - - - - - - -
void handleSelection(date)- - - - - - - - - - - -
void hide()- - - - - - - - - - - -
Object isLeapYear(y)- - - - - - - - - - - -
void refresh()- - - - - - - - - - - -
void selectToday()- - - - - - - - - - - -
void setSelectedDate(date)- - - - - - - - - - - -
void show(x, y, value, callback)- - - - - - - - - - - -
void showNextMonth()- - - - - - - - - - - -
void showNextYear()- - - - - - - - - - - -
void showPrevMonth()- - - - - - - - - - - -
void showPrevYear()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.DomHelper.Template -- - -
-
Represents an HTML fragment template
-
Defined in DomHelper.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.DomHelper.Template
-
- (<String> html)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- HTMLElement
-
- |
-
-
-
- append(<HTMLElement> el, <Object> values)
-
- - - Applies the supplied values to the template and append the new node(s) to el - |
-
-
- String
-
- |
-
-
-
- applyTemplate(<Object> values)
-
- - - Returns an HTML fragment of this template with the specified values applied - |
-
-
- void
-
- |
-
-
-
- compile()
-
- - - Compiles the template into an internal function, eliminating the RegEx overhead - |
-
-
- HTMLElement
-
- |
-
-
-
- insertAfter(<HTMLElement> el, <Object> values)
-
- - - Applies the supplied values to the template and inserts the new node(s) after el - |
-
-
- HTMLElement
-
- |
-
-
-
- insertBefore(<HTMLElement> el, <Object> values)
-
- - - Applies the supplied values to the template and inserts the new node(s) before el - |
-
-
- HTMLElement
-
- |
-
-
-
- overwrite(<HTMLElement> el, <Object> values)
-
- - - Applies the supplied values to the template and overwrites the content of el with the new node(s) - |
-
| - Constructor Detail - | -
YAHOO.ext.DomHelper.Template(<String> html)- - - - -
html - The HTML fragment
- | - Method Detail - | -
HTMLElement append(<HTMLElement> el, <Object> values)- -
el - The context element
- values - The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {YAHOO.ext.DomHelper.Template.prototype.foo = 'bar';})
- String applyTemplate(<Object> values)- -
values - The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {YAHOO.ext.DomHelper.Template.prototype.foo = 'bar';})
- void compile()- -
HTMLElement insertAfter(<HTMLElement> el, <Object> values)- -
el - The context element
- values - The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {YAHOO.ext.DomHelper.Template.prototype.foo = 'bar';})
- HTMLElement insertBefore(<HTMLElement> el, <Object> values)- -
el - The context element
- values - The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {YAHOO.ext.DomHelper.Template.prototype.foo = 'bar';})
- HTMLElement overwrite(<HTMLElement> el, <Object> values)- -
el - The context element
- values - The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {YAHOO.ext.DomHelper.Template.prototype.foo = 'bar';})
- Object - | - +--YAHOO.ext.DomHelper -- - -
| Nested Class Summary | -|
- <static class> |
- YAHOO.ext.DomHelper.Template |
-
| Field Summary | |
- Boolean |
- useDom
- - True to force the use of DOM instead of html fragments |
-
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- HTMLElement
-
- |
-
-
-
- append(<HTMLElement> el, <Object> o)
-
- - - Creates new Dom element(s) and appends them to el - |
-
-
- YAHOO.ext.DomHelper.Template
-
- |
-
-
-
- createTemplate(<Object> o)
-
- - - Creates a new YAHOO.ext.DomHelper.Template from the Dom object spec - |
-
-
- HTMLElement
-
- |
-
-
-
- insertAfter(<HTMLElement> el, <Object> o)
-
- - - Creates new Dom element(s) and inserts them after el - |
-
-
- HTMLElement
-
- |
-
-
-
- insertBefore(<HTMLElement> el, <Object> o)
-
- - - Creates new Dom element(s) and inserts them before el - |
-
-
- HTMLElement
-
- |
-
-
-
- insertHtml(<String> where, <HTMLElement> el, <String> html)
-
- - - Inserts an HTML fragment into the Dom - |
-
-
- HTMLElement
-
- |
-
-
-
- overwrite(<HTMLElement> el, <Object> o)
-
- - - Creates new Dom element(s) and overwrites the contents of el with them - |
-
| Field Detail | -
Boolean useDom-
| - Method Detail - | -
HTMLElement append(<HTMLElement> el, <Object> o)- -
el - The context element
- o - The Dom object spec (and children)
- YAHOO.ext.DomHelper.Template createTemplate(<Object> o)- -
o - The Dom object spec (and children)
- HTMLElement insertAfter(<HTMLElement> el, <Object> o)- -
el - The context element
- o - The Dom object spec (and children)
- HTMLElement insertBefore(<HTMLElement> el, <Object> o)- -
el - The context element
- o - The Dom object spec (and children)
- HTMLElement insertHtml(<String> where, <HTMLElement> el, <String> html)- -
where - Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd.
- el - The context element
- html - The HTML fragmenet
- HTMLElement overwrite(<HTMLElement> el, <Object> o)- -
el - The context element
- o - The Dom object spec (and children)
- Object - | - +--YAHOO.ext.Element -- -
-
Wraps around a DOM element and provides convenient access to Yahoo
- UI library functionality.
- Usage:
-
- var el = YAHOO.ext.Element.get('myElementId');
- // or the shorter
- var el = getEl('myElementId');
-
- Using YAHOO.ext.Element.get() instead of calling the constructor directly ensures you get the same object
- each call instead of constructing a new one.| Field Summary | |
- Object |
- autoBoxAdjust
- - Whether to automatically adjust width and height settings for box-model issues |
-
- String |
- defaultUnit
- - The default unit to append to CSS values where a unit isn't provided (Defaults to px). |
-
- String |
- id
- - The DOM element ID |
-
- CustomEvent |
- onMoved
- - Fires when element moves. |
-
- CustomEvent |
- onResized
- - Fires when element is resized. |
-
- CustomEvent |
- onVisibilityChanged
- - Fires when visibility changes. |
-
- <static> Number |
- DISPLAY
- - Visibility mode constant - Use display to hide element |
-
- <static> Number |
- VISIBILITY
- - Visibility mode constant - Use visibility to hide element |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.Element
-
- (<String> elementId, <Boolean> forceNew)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- addClass(<String> className)
-
- - - Add a CSS class to the element. - |
-
-
- void
-
- |
-
-
-
- addHandler(<String> eventName, <Boolean> stopPropagation, <Function> handler, <Object> scope, <boolean> override)
-
- - - Appends an event handler to this element and automatically prevents the default action, and if set stops propagation (bubbling) as well - |
-
-
- void
-
- |
-
-
-
- addListener(<String> eventName, <Function> handler, <Object> scope, <boolean> override)
-
- - - Appends an event handler to this element - |
-
-
- Object
-
- |
-
-
-
- addManagedListener(<String> eventName, <Function> fn, <Object> scope, <boolean> override)
-
- - - Append a managed listener - See YAHOO.ext.EventObject for more details. - |
-
-
- void
-
- |
-
-
-
- alignTo(<String/HTMLElement/YAHOO.ext.Element> element, <String> position, <Array> offsets, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
-
- - - Align this element with another element. - |
-
-
- void
-
- |
-
-
-
- animate(<Object> args, <Float> duration, <Function> onComplete, <Function> easing, <Function> animType)
-
- - - Perform Yahoo UI animation on this element. - |
-
-
- void
-
- |
-
-
-
- beginMeasure()
-
- - - - |
-
-
- void
-
- |
-
-
-
- clearOpacity()
-
- - - Clears any opacity settings from this element. - |
-
-
- void
-
- |
-
-
-
- clearPositioning()
-
- - - Clear positioning back to the default when the document was loaded - |
-
-
- void
-
- |
-
-
-
- clip()
-
- - - Clip overflow on the element - use unclip() to remove - |
-
-
- void
-
- |
-
-
-
- enableDisplayMode()
-
- - - Convenience method for setVisibilityMode(Element.DISPLAY) - |
-
-
- void
-
- |
-
-
-
- endMeasure()
-
- - - - |
-
-
- void
-
- |
-
-
-
- focus()
-
- - - Tries to focus the element. - |
-
-
- Number
-
- |
-
-
-
- getBorderWidth(<String> side)
-
- - - Gets the width of the border(s) for the specified side(s) - |
-
-
- String
-
- |
-
-
-
- getBottom()
-
- - - Gets the bottom Y coordinate of the element (element Y position + element height) - |
-
-
- void
-
- |
-
-
-
- getBox(contentBox)
-
- - - Return a box {x, y, width, height} that can be used to set another elements - size to match this element. - |
-
-
- Array
-
- |
-
-
-
- getCenterXY(offsetScroll)
-
- - - Calculates the x, y to center this element on the screen - |
-
-
- Array
-
- |
-
-
-
- getChildrenByClassName(<String> className, <String> tagName)
-
- - - Gets an array of child YAHOO.ext.Element objects by class name and optional tagName - |
-
-
- Array
-
- |
-
-
-
- getChildrenByTagName(<String> tagName)
-
- - - Gets an array of child YAHOO.ext.Element objects by tag name - |
-
-
- Number
-
- |
-
-
-
- getHeight()
-
- - - Returns the offset height of the element - |
-
-
- Object
-
- |
-
-
-
- getLeft()
-
- - - Same as getX() - |
-
-
- Number
-
- |
-
-
-
- getPadding(<String> side)
-
- - - Gets the width of the padding(s) for the specified side(s) - |
-
-
- void
-
- |
-
-
-
- getPositioning()
-
- - - Gets an object with all CSS positioning properties. - |
-
-
- Region
-
- |
-
-
-
- getRegion()
-
- - - Returns the region position of the given element. - |
-
-
- String
-
- |
-
-
-
- getRight()
-
- - - Gets the right X coordinate of the element (element X position + element width) - |
-
-
- Object}
-
- |
-
-
-
- getSize()
-
- - - Returns the size of the element - |
-
-
- String
-
- |
-
-
-
- getStyle(name)
-
- - - Normalizes currentStyle and ComputedStyle. - |
-
-
- Object
-
- |
-
-
-
- getTop()
-
- - - Same as getY() - |
-
-
- YAHOO.ext.UpdateManager
-
- |
-
-
-
- getUpdateManager()
-
- - - Gets this elements UpdateManager - |
-
-
- Number
-
- |
-
-
-
- getWidth()
-
- - - Returns the offset width of the element - |
-
-
- Object
-
- |
-
-
-
- getX()
-
- - - Gets the current X position of the element based on page coordinates. - |
-
-
- Object
-
- |
-
-
-
- getXY()
-
- - - Gets the current position of the element based on page coordinates. - |
-
-
- Object
-
- |
-
-
-
- getY()
-
- - - Gets the current Y position of the element based on page coordinates. - |
-
-
- Boolean
-
- |
-
-
-
- hasClass(<String> className)
-
- - - Checks if a CSS class is in use by the element. - |
-
-
- void
-
- |
-
-
-
- hide(<Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
-
- - - Hide this element - Uses display mode to determine whether to use "display" or "visibility". - |
-
-
- void
-
- |
-
-
-
- isBorderBox()
-
- - - Tests various css rules/browsers to determine if this element uses a border box - |
-
-
- Boolean
-
- |
-
-
-
- isVisible(<Boolean> deep)
-
- - - Checks whether the element is currently visible using both visibility and display properties. - |
-
-
- Object
-
- |
-
-
-
- mon(<String> eventName, <Function> fn, <Object> scope, <boolean> override)
-
- - - Append a managed listener (shorthanded for addManagedListener()) - |
-
-
- void
-
- |
-
-
-
- move(<String> direction, <Number> distance, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
-
- - - Move this element relative to it's current position. - |
-
-
- void
-
- |
-
-
-
- moveTo(<Number> x, <Number> y, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Set the position of the element in page coordinates, regardless of how the element is positioned. - |
-
-
- void
-
- |
-
-
-
- on(<String> eventName, <Function> handler, <Object> scope, <boolean> override)
-
- - - Appends an event handler to this element (Same as addListener) - |
-
-
- void
-
- |
-
-
-
- radioClass(className)
-
- - - Adds the passed className to this element and removes the class from all siblings - |
-
-
- void
-
- |
-
-
-
- removeAllListeners()
-
- - - Removes all previous added listeners from this element - |
-
-
- void
-
- |
-
-
-
- removeClass(<String> className)
-
- - - Removes a CSS class from the element. - |
-
-
- void
-
- |
-
-
-
- removeListener(eventName, handler)
-
- - - Removes an event handler from this element - |
-
-
- void
-
- |
-
-
-
- replaceClass(<String> oldClassName, <String> newClassName)
-
- - - Replaces a CSS class on the element with another. - |
-
-
- void
-
- |
-
-
-
- setAbsolutePositioned(<Number> zIndex)
-
- - - Set the element as absolute positioned with the specified z-index - |
-
-
- void
-
- |
-
-
-
- setBottom(bottom)
-
- - - Set the element's css bottom style - |
-
-
- void
-
- |
-
-
-
- setBounds(<Number> x, <Number> y, <Number> width, <Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Sets the element's position and size in one shot. - |
-
-
- void
-
- |
-
-
-
- setBox(<Object> box, <Boolean> adjust, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Sets the element's box. - |
-
-
- void
-
- |
-
-
-
- setHeight(<Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Set the height of the element - |
-
-
- void
-
- |
-
-
-
- setLeft(<String> left)
-
- - - Set the element's X position directly using CSS style (instead of setX()) - |
-
-
- void
-
- |
-
-
-
- setLocation(<Number> x, <Number> y, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Set the position of the element in page coordinates, regardless of how the element is positioned. - |
-
-
- void
-
- |
-
-
-
- setOpacity(<Float> opacity, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
-
- - - Set the opacity of the element - |
-
-
- void
-
- |
-
-
-
- setPositioning(positionCfg)
-
- - - Set positioning with an object returned by getPositioning(). - |
-
-
- void
-
- |
-
-
-
- setRegion(<YAHOO.util.Region> region, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Sets the element's position and size the the specified region. - |
-
-
- void
-
- |
-
-
-
- setRelativePositioned(<Number> zIndex)
-
- - - Set the element as relative positioned with the specified z-index - |
-
-
- void
-
- |
-
-
-
- setRight(right)
-
- - - Set the element's css right style - |
-
-
- void
-
- |
-
-
-
- setSize(<Number> width, <Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Set the size of the element. - |
-
-
- void
-
- |
-
-
-
- setStyle(name, value)
-
- - - Wrapper for setting style properties - |
-
-
- void
-
- |
-
-
-
- setTop(<String> top)
-
- - - Set the element's Y position directly using CSS style (instead of setY()) - |
-
-
- void
-
- |
-
-
-
- setVisibilityMode(visMode)
-
- - - Sets the elements visibility mode. - |
-
-
- void
-
- |
-
-
-
- setVisible(<Boolean> visible, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
-
- - - Sets the visibility of the element (see details). - |
-
-
- void
-
- |
-
-
-
- setWidth(<Number> width, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Set the width of the element - |
-
-
- void
-
- |
-
-
-
- setX(x)
-
- - - Sets the X position of the element based on page coordinates. - |
-
-
- void
-
- |
-
-
-
- setXY(<Array> pos, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Set the position of the element in page coordinates, regardless of how the element is positioned. - |
-
-
- void
-
- |
-
-
-
- setY(y)
-
- - - Sets the Y position of the element based on page coordinates. - |
-
-
- void
-
- |
-
-
-
- show(<Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)
-
- - - Show this element - Uses display mode to determine whether to use "display" or "visibility". - |
-
-
- void
-
- |
-
-
-
- toggle(<Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)
-
- - - Toggles the elements visibility or display, depending on visibility mode. - |
-
-
- void
-
- |
-
-
-
- toggleClass(className)
-
- - - - |
-
-
- void
-
- |
-
-
-
- unclip()
-
- - - Return clipping (overflow) to original clipping when the document loaded - |
-
-
- void
-
- |
-
-
-
- update(<String> html, <Boolean> loadScripts)
-
- - - Update the innerHTML of this element, optionally searching for and processing scripts - |
-
-
- <static> Element
-
- |
-
-
-
- get(<String/HTMLElement/Element> el, <Boolean> autoGenerateId)
-
- - - Static method to retreive Element objects. - |
-
| Field Detail | -
Object autoBoxAdjust-
String defaultUnit-
String id-
CustomEvent onMoved-
CustomEvent onResized-
CustomEvent onVisibilityChanged-
<static> Number DISPLAY-
<static> Number VISIBILITY-
| - Constructor Detail - | -
YAHOO.ext.Element(<String> elementId, <Boolean> forceNew)- - - - -
elementId -
- forceNew - (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).
- | - Method Detail - | -
void addClass(<String> className)- -
className - The CSS class to add
- void addHandler(<String> eventName, <Boolean> stopPropagation, <Function> handler, <Object> scope, <boolean> override)- -
eventName - The type of event to listen for
- stopPropagation - Whether to also stopPropagation (bubbling)
- handler - The method the event invokes
- scope - (optional) An arbitrary object that will be passed as a parameter to the handler
- override - (optional) If true, the obj passed in becomes the execution scope of the listener
- void addListener(<String> eventName, <Function> handler, <Object> scope, <boolean> override)- -
eventName - The type of event to listen for
- handler - The method the event invokes
- scope - (optional) An arbitrary object that will be passed as a parameter to the handler
- override - (optional) If true, the obj passed in becomes the execution scope of the listener
- Object addManagedListener(<String> eventName, <Function> fn, <Object> scope, <boolean> override)- -
eventName - The type of event to listen for
- fn - The method the event invokes
- scope - (optional) An arbitrary object that will be passed as a parameter to the handler
- override - (optional) If true, the obj passed in becomes the execution scope of the listener
- void alignTo(<String/HTMLElement/YAHOO.ext.Element> element, <String> position, <Array> offsets, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)- -
element - The element to align to.
- position - The position to align to. Possible values are 'tl' - top left, 'tr' - top right, 'bl' - bottom left, and 'br' - bottom right.
- offsets - (optional) Offset the positioning by [x, y]
- animate - (optional) Animate the movement (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use.
- void animate(<Object> args, <Float> duration, <Function> onComplete, <Function> easing, <Function> animType)- -
args - The YUI animation control args
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- animType - (optional) YAHOO.util.Anim subclass to use. For YAHOO.ext.Element.prototype.example = YAHOO;.util.Motion
- void beginMeasure()- - - - - - - - - - - -
void clearOpacity()- -
void clearPositioning()- -
void clip()- -
void enableDisplayMode()- -
void endMeasure()- - - - - - - - - - - -
void focus()- -
Number getBorderWidth(<String> side)- -
side - Can be t, l, r, b or any combination of those to add multiple values. For example, passing lr would get the border (l)eft width + the border (r)ight width.
- String getBottom()- -
void getBox(contentBox)- -
Array getCenterXY(offsetScroll)- -
Array getChildrenByClassName(<String> className, <String> tagName)- -
className -
- tagName - (optional)
- Array getChildrenByTagName(<String> tagName)- -
tagName -
- Number getHeight()- -
Object getLeft()- -
Number getPadding(<String> side)- -
side - Can be t, l, r, b or any combination of those to add multiple values. For example, passing lr would get the padding (l)eft + the padding (r)ight.
- void getPositioning()- -
Region getRegion()- -
String getRight()- -
Object} getSize()- -
String getStyle(name)- -
property - The style property whose value is returned.
- Object getTop()- -
YAHOO.ext.UpdateManager getUpdateManager()- -
Number getWidth()- -
Object getX()- -
Object getXY()- -
Object getY()- -
Boolean hasClass(<String> className)- -
className - The CSS class to check
- void hide(<Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)- -
animate - (optional) Animate (fade) the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void isBorderBox()- -
Boolean isVisible(<Boolean> deep)- -
deep - True to walk the dom and see if parent elements are hidden
- Object mon(<String> eventName, <Function> fn, <Object> scope, <boolean> override)- -
eventName - The type of event to listen for
- fn - The method the event invokes
- scope - (optional) An arbitrary object that will be passed as a parameter to the handler
- override - (optional) If true, the obj passed in becomes the execution scope of the listener
- void move(<String> direction, <Number> distance, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)- -
direction - Possible values YAHOO.ext.Element.prototype.are = 'left'; 'right', 'up', 'down'.
- distance - How far to move the element in pixels
- animate - (optional) Animate the movement (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use.
- void moveTo(<Number> x, <Number> y, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
x - X value for new position (coordinates are page-based)
- y - Y value for new position (coordinates are page-based)
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void on(<String> eventName, <Function> handler, <Object> scope, <boolean> override)- -
eventName - The type of event to listen for
- handler - The method the event invokes
- scope - (optional) An arbitrary object that will be passed as a parameter to the handler
- override - (optional) If true, the obj passed in becomes the execution scope of the listener
- void radioClass(className)- -
void removeAllListeners()- -
void removeClass(<String> className)- -
className - The CSS class to remove
- void removeListener(eventName, handler)- -
sType - the type of event to remove
- fn - the method the event invokes
- void replaceClass(<String> oldClassName, <String> newClassName)- -
oldClassName - The CSS class to replace
- newClassName - The replacement CSS class
- void setAbsolutePositioned(<Number> zIndex)- -
zIndex - (optional)
- void setBottom(bottom)- -
top - The bottom CSS property value
- void setBounds(<Number> x, <Number> y, <Number> width, <Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
x - X value for new position (coordinates are page-based)
- y - Y value for new position (coordinates are page-based)
- width - The new width
- height - The new height
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void setBox(<Object> box, <Boolean> adjust, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
box - The box to fill {x, y, width, height}
- adjust - (optional) Whether to adjust for box-model issues automatically
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void setHeight(<Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
height - The new height
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut if height is larger or YAHOO.util.Easing.easeIn if it is smaller)
- void setLeft(<String> left)- -
left - The left CSS property value
- void setLocation(<Number> x, <Number> y, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
x - X value for new position (coordinates are page-based)
- y - Y value for new position (coordinates are page-based)
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void setOpacity(<Float> opacity, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)- -
opacity - The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
- animate - (optional) Animate (fade) the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut if height is larger or YAHOO.util.Easing.easeIn if it is smaller)
- void setPositioning(positionCfg)- -
void setRegion(<YAHOO.util.Region> region, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
region - The region to fill
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void setRelativePositioned(<Number> zIndex)- -
zIndex - (optional)
- void setRight(right)- -
left - The right CSS property value
- void setSize(<Number> width, <Number> height, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
width - The new width
- height - The new height
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void setStyle(name, value)- -
property - The style property to be set.
- val - The value to apply to the given property.
- void setTop(<String> top)- -
top - The top CSS property value
- void setVisibilityMode(visMode)- -
visMode - Element.VISIBILITY or Element.DISPLAY
- void setVisible(<Boolean> visible, <Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)- -
visible - Whether the element is visible
- animate - (optional) Fade the element in or out (Default is false)
- duration - (optional) How long the fade effect lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut for hiding or YAHOO.util.Easing.easeIn for showing)
- void setWidth(<Number> width, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
width - The new width
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut if width is larger or YAHOO.util.Easing.easeIn if it is smaller)
- void setX(x)- -
The - X position of the element
- void setXY(<Array> pos, <Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
pos - Contains X & Y [x, y] values for new position (coordinates are page-based)
- animate - (optional) Animate the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void setY(y)- -
The - Y position of the element
- void show(<Boolean> animate, <Float> duration, <Function> onComplete, <Function> easing)- -
animate - (optional) Animate (fade in) the transition (Default is false)
- duration - (optional) How long the animation lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth)
- void toggle(<Boolean> animate, <float> duration, <Function> onComplete, <Function> easing)- -
animate - (optional) Fade the element in or out (Default is false)
- duration - (optional) How long the fade effect lasts. (Defaults to .35 seconds)
- onComplete - (optional) Function to call when animation completes.
- easing - (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut for hiding or YAHOO.util.Easing.easeIn for showing)
- void toggleClass(className)- - - - - - - - - - - -
void unclip()- -
void update(<String> html, <Boolean> loadScripts)- -
html - The new HTML
- loadScripts - (optional) true to look for and process scripts
- <static> Element get(<String/HTMLElement/Element> el, <Boolean> autoGenerateId)- -
el - The id of the element or the element to wrap (must have an id). If you pass in an element, it is returned
- autoGenerateId - (optional) Set this flag to true if you are passing an element without an id (like document.body). It will auto generate an id if one isn't present.
- Object - | - +--YAHOO.ext.EventManager -- - -
| Field Summary | |
- Object |
- ieDeferSrc
- - |
-
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Function
-
- |
-
-
-
- addListener(<Object> element, <String> eventName, <Function> fn, <Object> scope, <boolean> override)
-
- - - Appends an event handler - |
-
-
- Function
-
- |
-
-
-
- on(<Object> element, <String> eventName, <Function> fn, <Object> scope, <boolean> override)
-
- - - Appends an event handler (shorthand for addListener) - |
-
-
- void
-
- |
-
-
-
- onDocumentReady(fn, scope, override)
-
- - - Fires when the document is ready (before onload) - |
-
-
- Boolean
-
- |
-
-
-
- removeListener(<Object> element, <String> eventName, <Function> wrappedFn)
-
- - - Removes an event handler - |
-
-
- Object
-
- |
-
-
-
- wrap(fn, scope, override)
-
- - - Places a simple wrapper around an event handler to override the browser event - object with a YAHOO.ext.EventObject - |
-
| Field Detail | -
Object ieDeferSrc-
| - Method Detail - | -
Function addListener(<Object> element, <String> eventName, <Function> fn, <Object> scope, <boolean> override)- -
element - The html element to assign the event to
- eventName - The type of event to append
- fn - The method the event invokes
- scope - An arbitrary object that will be passed as a parameter to the handler
- override - If true, the obj passed in becomes the execution scope of the listener
- Function on(<Object> element, <String> eventName, <Function> fn, <Object> scope, <boolean> override)- -
element - The html element to assign the event to
- eventName - The type of event to append
- fn - The method the event invokes
- scope - An arbitrary object that will be passed as a parameter to the handler
- override - If true, the obj passed in becomes the execution scope of the listener
- void onDocumentReady(fn, scope, override)- -
Boolean removeListener(<Object> element, <String> eventName, <Function> wrappedFn)- -
element - The html element to remove the event from
- eventName - The type of event to append
- wrappedFn - The wrapper method returned when adding the listener
- Object wrap(fn, scope, override)- -
Object - | - +--YAHOO.ext.EventObject -- - -
| Field Summary | |
- Object |
- altKey
- - True if the alt key was down during the event |
-
- Number |
- BACKSPACE
- - Key constant |
-
- Object |
- browserEvent
- - The normal browser event |
-
- Object |
- button
- - The button pressed in a mouse event |
-
- Object |
- ctrlKey
- - True if the control key was down during the event |
-
- Number |
- DELETE
- - Key constant |
-
- Number |
- DOWN
- - Key constant |
-
- Number |
- END
- - Key constant |
-
- Number |
- ESC
- - Key constant |
-
- Number |
- F5
- - Key constant |
-
- Number |
- HOME
- - Key constant |
-
- Number |
- LEFT
- - Key constant |
-
- Number |
- PAGEDOWN
- - Key constant |
-
- Number |
- PAGEUP
- - Key constant |
-
- Number |
- RETURN
- - Key constant |
-
- Number |
- RIGHT
- - Key constant |
-
- Object |
- shiftKey
- - True if the shift key was down during the event |
-
- Number |
- SPACE
- - Key constant |
-
- Number |
- TAB
- - Key constant |
-
- Number |
- UP
- - Key constant |
-
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- HTMLelement
-
- |
-
-
-
- findTarget(className, tagName)
-
- - - Walk up the DOM looking for a particular target - if the default target matches, it is returned. - |
-
-
- Number
-
- |
-
-
-
- getCharCode()
-
- - - Gets the key code for the event. - |
-
-
- Number
-
- |
-
-
-
- getPageX()
-
- - - Gets the x coordinate of the event. - |
-
-
- Number
-
- |
-
-
-
- getPageY()
-
- - - Gets the y coordinate of the event. - |
-
-
- HTMLelement
-
- |
-
-
-
- getRelatedTarget()
-
- - - Gets the related target. - |
-
-
- HTMLelement
-
- |
-
-
-
- getTarget()
-
- - - Gets the target for the event. - |
-
-
- Number
-
- |
-
-
-
- getTime()
-
- - - Gets the time of the event. - |
-
-
- Object
-
- |
-
-
-
- getWheelDelta()
-
- - - Normalizes mouse wheel delta across browsers - |
-
-
- Array
-
- |
-
-
-
- getXY()
-
- - - Gets the page coordinates of the event. - |
-
-
- Boolean
-
- |
-
-
-
- hasModifier()
-
- - - Returns true if the control, shift or alt key was pressed during this event. - |
-
-
- void
-
- |
-
-
-
- preventDefault()
-
- - - Prevents the browsers default handling of the event. - |
-
-
- void
-
- |
-
-
-
- stopEvent()
-
- - - Stop the event. - |
-
-
- void
-
- |
-
-
-
- stopPropagation()
-
- - - Cancels bubbling of the event. - |
-
| Field Detail | -
Object altKey-
Number BACKSPACE-
Object browserEvent-
Object button-
Object ctrlKey-
Number DELETE-
Number DOWN-
Number END-
Number ESC-
Number F5-
Number HOME-
Number LEFT-
Number PAGEDOWN-
Number PAGEUP-
Number RETURN-
Number RIGHT-
Object shiftKey-
Number SPACE-
Number TAB-
Number UP-
| - Method Detail - | -
HTMLelement findTarget(className, tagName)- -
Number getCharCode()- -
Number getPageX()- -
Number getPageY()- -
HTMLelement getRelatedTarget()- -
HTMLelement getTarget()- -
Number getTime()- -
Object getWheelDelta()- -
Array getXY()- -
Boolean hasModifier()- -
void preventDefault()- -
void stopEvent()- -
void stopPropagation()- -
Object - | - +--YAHOO.ext.Resizable -- - -
-
Makes an element resizable.
-
-
Defined in Resizable.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.Resizable
-
- (el, config)
-
- - - - |
-|
| - Constructor Detail - | -
YAHOO.ext.Resizable(el, config)- - - - - - - - - - - - - -
Object - | - +--YAHOO.ext.SplitBar.AbsoluteLayoutAdapter -- - -
-
Adapter that moves the splitter element to align with the resized sizing element.
- Used with an absolute positioned SplitBar.
-
Defined in SplitBar.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.SplitBar.AbsoluteLayoutAdapter
-
- (<String/HTMLElement/Element> container)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- getElementSize(s)
-
- - - - |
-
-
- void
-
- |
-
-
-
- init(s)
-
- - - - |
-
-
- void
-
- |
-
-
-
- moveSplitter(s)
-
- - - - |
-
-
- void
-
- |
-
-
-
- setElementSize(s, newSize, onComplete)
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.SplitBar.AbsoluteLayoutAdapter(<String/HTMLElement/Element> container)- - - - -
container - The container that wraps around the absolute positioned content. If it's document.body, make sure you assign an id to the body element.
- | - Method Detail - | -
Object getElementSize(s)- - - - - - - - - - - -
void init(s)- - - - - - - - - - - -
void moveSplitter(s)- - - - - - - - - - - -
void setElementSize(s, newSize, onComplete)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.SplitBar.BasicLayoutAdapter -- - -
-
Default Adapter. It assumes the splitter and resizing element are not positioned
- elements and only gets/sets the width of the element. Generally used for table based layouts.
-
-
Defined in SplitBar.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.SplitBar.BasicLayoutAdapter
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- getElementSize(<YAHOO.ext.SplitBar> s)
-
- - - Called before drag operations to get the current size of the resizing element. - |
-
-
- void
-
- |
-
-
-
- init(s)
-
- - - - |
-
-
- void
-
- |
-
-
-
- setElementSize(<YAHOO.ext.SplitBar> s, <Number> newSize, <Function> onComplete)
-
- - - Called after drag operations to set the size of the resizing element. - |
-
| - Constructor Detail - | -
YAHOO.ext.SplitBar.BasicLayoutAdapter()- - - - - - - - - - - - - -
| - Method Detail - | -
Object getElementSize(<YAHOO.ext.SplitBar> s)- -
s - The SplitBar using this adapter
- void init(s)- - - - - - - - - - - -
void setElementSize(<YAHOO.ext.SplitBar> s, <Number> newSize, <Function> onComplete)- -
s - The SplitBar using this adapter
- newSize - The new size to set
- onComplete - A function to be invoke when resizing is complete
- Object - | - +--YAHOO.ext.SplitBar -- - -
-
Creates draggable splitter bar functionality from two elements.
-
- Usage:
-
- var split = new YAHOO.ext.SplitBar('elementToDrag', 'elementToSize',
- YAHOO.ext.SplitBar.HORIZONTAL, YAHOO.ext.SplitBar.LEFT);
- split.setAdapter(new YAHOO.ext.SplitBar.AbsoluteLayoutAdapter("container"));
- split.minSize = 100;
- split.maxSize = 600;
- split.animate = true;
- split.onMoved.subscribe(splitterMoved);
-
- | Nested Class Summary | -|
- <static class> |
- YAHOO.ext.SplitBar.BasicLayoutAdapter |
-
- <static class> |
- YAHOO.ext.SplitBar.AbsoluteLayoutAdapter |
-
| Field Summary | |
- Boolean |
- animate
- - Whether to animate the transition to the new size |
-
- Number |
- maxSize
- - The maximum size of the resizing element. |
-
- Number |
- minSize
- - The minimum size of the resizing element. |
-
- CustomEvent |
- onMoved
- - Fires when the SplitBar is moved. |
-
- Boolean |
- useShim
- - Whether to create a transparent shim that overlays the page when dragging, enables dragging across iframes. |
-
- <static> Number |
- BOTTOM
- - Placement constant - The resizing element is positioned under splitter element |
-
- <static> Number |
- HORIZONTAL
- - Orientation constant - Create a horizontal SplitBar |
-
- <static> Number |
- LEFT
- - Placement constant - The resizing element is to the left of the splitter element |
-
- <static> Number |
- RIGHT
- - Placement constant - The resizing element is to the right of the splitter element |
-
- <static> Number |
- TOP
- - Placement constant - The resizing element is positioned above the splitter element |
-
- <static> Number |
- VERTICAL
- - Orientation constant - Create a vertical SplitBar |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.SplitBar
-
- (<String/HTMLElement/Element> dragElement, <String/HTMLElement/Element> resizingElement, <Number> orientation, <Number> placement)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- getAdapter()
-
- - - Get the adapter this SplitBar uses - |
-
-
- Number
-
- |
-
-
-
- getMaximumSize()
-
- - - Gets the maximum size for the resizing element - |
-
-
- Number
-
- |
-
-
-
- getMinimumSize()
-
- - - Gets the minimum size for the resizing element - |
-
-
- void
-
- |
-
-
-
- setAdapter(<Object> adapter)
-
- - - Set the adapter this SplitBar uses - |
-
-
- void
-
- |
-
-
-
- setCurrentSize(<Number> size)
-
- - - Sets the initialize size for the resizing element - |
-
-
- void
-
- |
-
-
-
- setMaximumSize(<Number> maxSize)
-
- - - Sets the maximum size for the resizing element - |
-
-
- void
-
- |
-
-
-
- setMinimumSize(<Number> minSize)
-
- - - Sets the minimum size for the resizing element - |
-
| Field Detail | -
Boolean animate-
Number maxSize-
Number minSize-
CustomEvent onMoved-
Boolean useShim-
<static> Number BOTTOM-
<static> Number HORIZONTAL-
<static> Number LEFT-
<static> Number RIGHT-
<static> Number TOP-
<static> Number VERTICAL-
| - Constructor Detail - | -
YAHOO.ext.SplitBar(<String/HTMLElement/Element> dragElement, <String/HTMLElement/Element> resizingElement, <Number> orientation, <Number> placement)- - - - -
dragElement - The element to be dragged and act as the SplitBar.
- resizingElement - The element to be resized based on where the SplitBar element is dragged
- orientation - (optional) Either YAHOO.ext.SplitBar.HORIZONTAL or YAHOO.ext.SplitBar.VERTICAL. (Defaults to HORIZONTAL)
- placement - (optional) Either YAHOO.ext.SplitBar.LEFT or YAHOO.ext.SplitBar.RIGHT for horizontal or YAHOO.ext.SplitBar.TOP or YAHOO.ext.SplitBar.BOTTOM for vertical. (By default, this is determined automatically by the intial position position of the SplitBar).
- | - Method Detail - | -
Object getAdapter()- -
Number getMaximumSize()- -
Number getMinimumSize()- -
void setAdapter(<Object> adapter)- -
adapter - A SplitBar adapter object
- void setCurrentSize(<Number> size)- -
size - The initial size
- void setMaximumSize(<Number> maxSize)- -
maxSize - The maximum size
- void setMinimumSize(<Number> minSize)- -
minSize - The minimum size
- Object - | - +--YAHOO.ext.TabPanel -- - -
-
Creates a lightweight TabPanel component using Yahoo! UI.
-
- Usage:
-
- // basic tabs 1, built from existing content
- var tabs = new YAHOO.ext.TabPanel('tabs1');
- tabs.addTab('script', "View Script");
- tabs.addTab('markup', "View Markup");
- tabs.activate('script');
-
- // more advanced tabs, built from javascript
- var jtabs = new YAHOO.ext.TabPanel('jtabs');
- jtabs.addTab('jtabs-1', "Normal Tab", "My content was added during construction.");
-
- // set up the UpdateManager
- var tab2 = jtabs.addTab('jtabs-2', "Ajax Tab 1");
- var updater = tab2.getUpdateManager();
- updater.setDefaultUrl('ajax1.htm');
- tab2.onActivate.subscribe(updater.refresh, updater, true);
-
- // Use setUrl for Ajax loading
- var tab3 = jtabs.addTab('jtabs-3', "Ajax Tab 2");
- tab3.setUrl('ajax2.htm', null, true);
-
- // Disabled tab
- var tab4 = jtabs.addTab('tabs1-5', "Disabled Tab", "Can't see me cause I'm disabled");
- tab4.disable();
-
- jtabs.activate('jtabs-1');
-}
-
- | Field Summary | |
- YAHOO.ext.Element |
- bodyEl
- - The body element that contains TabPaneItem bodies. |
-
- YAHOO.ext.Element |
- el
- - The container element for this TabPanel. |
-
- CustomEvent |
- onTabChange
- - Fires when the active TabPanelItem changes. |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.TabPanel
-
- (<String/HTMLElement/Element> container)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- activate(<String> id)
-
- - - Activate a TabPanelItem. - |
-
-
- YAHOO.ext.TabPanelItem
-
- |
-
-
-
- addTab(<String> id, <String> text, <String> content)
-
- - - Creates a new TabPanelItem by looking for an existing element with the provided id - if it's not found it creates one. - |
-
-
- void
-
- |
-
-
-
- addTabItem(<YAHOO.ext.TabPanelItem> item)
-
- - - Add an existing TabPanelItem. - |
-
-
- void
-
- |
-
-
-
- disableTab(<String> id)
-
- - - Disable a TabPanelItem. - |
-
-
- void
-
- |
-
-
-
- enableTab(<String> id)
-
- - - Enable a TabPanelItem that is disabled. - |
-
-
- YAHOO.ext.TabPanelItem
-
- |
-
-
-
- getActiveTab()
-
- - - Get the active TabPanelItem - |
-
-
- YAHOO.ext.TabPanelItem
-
- |
-
-
-
- getTab(<String> id)
-
- - - Returns the TabPanelItem with the specified id - |
-
-
- void
-
- |
-
-
-
- removeTab(<String> id)
-
- - - Remove a TabPanelItem. - |
-
| Field Detail | -
YAHOO.ext.Element bodyEl-
YAHOO.ext.Element el-
CustomEvent onTabChange-
| - Constructor Detail - | -
YAHOO.ext.TabPanel(<String/HTMLElement/Element> container)- - - - -
container - The id, DOM element or YAHOO.ext.Element container where this TabPanel is to be rendered.
- | - Method Detail - | -
void activate(<String> id)- -
id - The id of the TabPanelItem to activate.
- YAHOO.ext.TabPanelItem addTab(<String> id, <String> text, <String> content)- -
id - The id of the div to use or create
- text - The text for the tab
- content - (optional) Content to put in the TabPanelItem body
- void addTabItem(<YAHOO.ext.TabPanelItem> item)- -
item - The TabPanelItem to add
- void disableTab(<String> id)- -
id - The id of the TabPanelItem to disable.
- void enableTab(<String> id)- -
id - The id of the TabPanelItem to enable.
- YAHOO.ext.TabPanelItem getActiveTab()- -
YAHOO.ext.TabPanelItem getTab(<String> id)- -
id - The id of the TabPanelItem to fetch.
- void removeTab(<String> id)- -
id - The id of the TabPanelItem to remove.
- Object - | - +--YAHOO.ext.TabPanelItem -- - -
- Defined in TabPanel.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.TabPanelItem
-
- (tabPanel, id, text)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- activate()
-
- - - Activate this TabPanelItem - this does deactivate the currently active TabPanelItem. - |
-
-
- void
-
- |
-
-
-
- disable()
-
- - - Disable this TabPanelItem - this call is ignore if this is the active TabPanelItem. - |
-
-
- void
-
- |
-
-
-
- enable()
-
- - - Enable this TabPanelItem if it was previously disabled. - |
-
-
- YAHOO.ext.UpdateManager
-
- |
-
-
-
- getUpdateManager()
-
- - - Get the YAHOO.ext.UpdateManager for the body of this TabPanelItem. - |
-
-
- void
-
- |
-
-
-
- hide()
-
- - - Hide this TabPanelItem - if you don't activate another TabPanelItem this could look odd. - |
-
-
- void
-
- |
-
-
-
- setContent(<String> content)
-
- - - Set the content for this TabPanelItem. - |
-
-
- void
-
- |
-
-
-
- setText(text)
-
- - - - |
-
-
- YAHOO.ext.UpdateManager
-
- |
-
-
-
- setUrl(<String/Function> url, <String/Object> params, <Boolean> loadOnce)
-
- - - Set a URL to be used to load the content for this TabPanelItem. - |
-
-
- void
-
- |
-
-
-
- show()
-
- - - Show this TabPanelItem - this does not deactivate the currently active TabPanelItem. - |
-
| - Constructor Detail - | -
YAHOO.ext.TabPanelItem(tabPanel, id, text)- - - - - - - - - - - - - -
| - Method Detail - | -
void activate()- -
void disable()- -
void enable()- -
YAHOO.ext.UpdateManager getUpdateManager()- -
void hide()- -
void setContent(<String> content)- -
content - The content
- void setText(text)- - - - - - - - - - - -
YAHOO.ext.UpdateManager setUrl(<String/Function> url, <String/Object> params, <Boolean> loadOnce)- -
url - The url to load the content from or a function to call to get the url
- params - (optional) The string params for the update call or an object of the params. See YAHOO.ext.UpdateManager.update() for more details. (Defaults to null)
- loadOnce - (optional) Whether to only load the content once. If this is false it makes the Ajax call every time this TabPanelItem is activated. (Defaults to false)
- void show()- -
Object - | - +--YAHOO.ext.Toolbar -- - -
-
Basic Toolbar used by the Grid to create the paging toolbar. This class is reusable but functionality
- is limited. Look for more functionality in a future version.
-
-
Defined in Toolbar.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.Toolbar
-
- (container)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- add()
-
- - - Adds element(s) to the toolbar - this function takes a variable number of - arguments of mixed type and adds them to the toolbar... - |
-
-
- YAHOO.ext.ToolbarButton
-
- |
-
-
-
- addButton(config)
-
- - - Adds a button, see YAHOO.ext.ToolbarButton for more info on the config - |
-
-
- void
-
- |
-
-
-
- addSeparator()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- addText(text)
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.Toolbar(container)- - - - - - - - - - - - - -
| - Method Detail - | -
void add()- -
YAHOO.ext.ToolbarButton addButton(config)- -
void addSeparator()- - - - - - - - - - - -
Object addText(text)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.ToolbarButton -- - -
-
A toolbar button. The config has the following options:
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.ToolbarButton
-
- (config)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- disable()
-
- - - - |
-
-
- void
-
- |
-
-
-
- enable()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- isDisabled()
-
- - - - |
-
-
- void
-
- |
-
-
-
- setDisabled(disabled)
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.ToolbarButton(config)- - - - - - - - - - - - - -
| - Method Detail - | -
void disable()- - - - - - - - - - - -
void enable()- - - - - - - - - - - -
Object isDisabled()- - - - - - - - - - - -
void setDisabled(disabled)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.UpdateManager.BasicRenderer -- - -
-
Default Content renderer. Updates the elements innerHTML with the responseText.
-
-
Defined in UpdateManager.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.UpdateManager.BasicRenderer
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- render(<YAHOO.ext.Element> el, <Object> response, updateManager)
-
- - - This is called when the transaction is completed and it's time to update the element - The BasicRenderer - updates the elements innerHTML with the responseText - To perform a custom render (i.e. - |
-
| - Constructor Detail - | -
YAHOO.ext.UpdateManager.BasicRenderer()- - - - - - - - - - - - - -
| - Method Detail - | -
void render(<YAHOO.ext.Element> el, <Object> response, updateManager)- -
el - The element being rendered
- response - The YUI Connect response object
- Object - | - +--YAHOO.ext.UpdateManager -- - -
-
Provides AJAX-style update for Element object using Yahoo
- UI library YAHOO.util.Connect functionality.
- Usage:
-
- // Get it from a YAHOO.ext.Element object
- var mgr = myElement.getUpdateManager();
- mgr.update('http://myserver.com/index.php', 'param1=1¶m2=2');
- ...
- mgr.formUpdate('myFormId', 'http://myserver.com/index.php');
-
- // or directly (returns the same UpdateManager instance)
- var mgr = new YAHOO.ext.UpdateManager('myElementId');
- mgr.startAutoRefresh('http://myserver.com/index.php', 60);
- mgr.onUpdate.subscribe(myFcnNeedsToKnow);
-
-
- | Nested Class Summary | -|
- <static class> |
- YAHOO.ext.UpdateManager.BasicRenderer |
-
| Field Summary | |
- YAHOO.util.CustomEvent |
- beforeUpdate
- - fired before update is made, return false from your handler and the update is cancelled. |
-
- String |
- defaultUrl
- - Cached url to use for refreshes. |
-
- Boolean |
- disableCaching
- - Whether to append unique parameter on get request to disable caching (Defaults to YAHOO.ext.UpdateManager.defaults.disableCaching or false). |
-
- YAHOO.ext.Element |
- el
- - The Element object |
-
- Function |
- formUpdateDelegate
- - Delegate for formUpdate() prebound to 'this', use myUpdater.formUpdateDelegate.createCallback(arg1, arg2) to bind arguments |
-
- String |
- indicatorText
- - Text for loading indicator (Defaults to YAHOO.ext.UpdateManager.defaults.indicatorText or '<div class="loading-indicator">Loading...</div>'). |
-
- Number |
- loadScripts
- - True to process scripts in the output (Defaults to YAHOO.ext.UpdateManager.defaults.loadScripts (false)). |
-
- YAHOO.util.CustomEvent |
- onFailure
- - Fired on update failure. |
-
- YAHOO.util.CustomEvent |
- onUpdate
- - Fired after successful update is made. |
-
- Function |
- refreshDelegate
- - Delegate for refresh() prebound to 'this', use myUpdater.refreshDelegate.createCallback(arg1, arg2) to bind arguments |
-
- Object |
- renderer
- - The renderer for this UpdateManager. |
-
- String |
- showLoadIndicator
- - Whether to show indicatorText when loading (Defaults to YAHOO.ext.UpdateManager.defaults.showLoadIndicator or true). |
-
- String |
- sslBlankUrl
- - Blank page URL to use with SSL file uploads (Defaults to YAHOO.ext.UpdateManager.defaults.sslBlankUrl or 'about:blank'). |
-
- Number |
- timeout
- - Timeout for requests or form posts in seconds (Defaults to YAHOO.ext.UpdateManager.defaults.timeout or 30 seconds). |
-
- Object |
- transaction
- - YAHOO.util.Connect transaction object of current executing transaction |
-
- Function |
- updateDelegate
- - Delegate for update() prebound to 'this', use myUpdater.updateDelegate.createCallback(arg1, arg2) to bind arguments |
-
- <static> Object |
- defaults
- - The defaults collection enables customizing the default behavior of UpdateManager |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.UpdateManager
-
- (<String/HTMLElement/YAHOO.ext.Element> el, <Boolean> forceNew)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- abort()
-
- - - Aborts the executing transaction - |
-
-
- void
-
- |
-
-
-
- formUpdate(<String/HTMLElement> form, <String> url, <Boolean> reset, <Function> callback)
-
- - - Performs an async form post, updating this element with the response. - |
-
-
- YAHOO.ext.Element
-
- |
-
-
-
- getEl()
-
- - - Get the Element this UpdateManager is bound to - |
-
-
- Object
-
- |
-
-
-
- getRenderer()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- isUpdating()
-
- - - Returns true if an update is in progress - |
-
-
- void
-
- |
-
-
-
- refresh(<Function> callback)
-
- - - Refresh the element with the last used url or defaultUrl. - |
-
-
- void
-
- |
-
-
-
- setDefaultUrl(<String/Function> defaultUrl)
-
- - - Set the defaultUrl used for updates - |
-
-
- void
-
- |
-
-
-
- setRenderer(<Object> renderer)
-
- - - Set the content renderer for this UpdateManager. - |
-
-
- void
-
- |
-
-
-
- showLoading()
-
- - - Called to update the element to "Loading" state. - |
-
-
- void
-
- |
-
-
-
- startAutoRefresh(<Number> interval, <String/Function> url, <String/Object> params, <Function> callback, <Boolean> refreshNow)
-
- - - Set this element to auto refresh. - |
-
-
- void
-
- |
-
-
-
- stopAutoRefresh()
-
- - - Stop auto refresh on this element. - |
-
-
- void
-
- |
-
-
-
- update(<String/Function> url, <String/Object> params, <Function> callback, <Boolean> discardUrl)
-
- - - Performs an async request, updating this element with the response. - |
-
| Field Detail | -
YAHOO.util.CustomEvent beforeUpdate-
String defaultUrl-
Boolean disableCaching-
YAHOO.ext.Element el-
Function formUpdateDelegate-
String indicatorText-
Number loadScripts-
YAHOO.util.CustomEvent onFailure-
YAHOO.util.CustomEvent onUpdate-
Function refreshDelegate-
Object renderer-
String showLoadIndicator-
String sslBlankUrl-
Number timeout-
Object transaction-
Function updateDelegate-
<static> Object defaults-
| - Constructor Detail - | -
YAHOO.ext.UpdateManager(<String/HTMLElement/YAHOO.ext.Element> el, <Boolean> forceNew)- - - - -
el - The element to update
- forceNew - (optional) By default the constructor checks to see if the passed element already has an UpdateManager and if it does it returns the same instance. This will skip that check (useful for extending this class).
- | - Method Detail - | -
void abort()- -
void formUpdate(<String/HTMLElement> form, <String> url, <Boolean> reset, <Function> callback)- -
form - The form Id or form element
- url - (optional) The url to pass the form to. If omitted the action attribute on the form will be used.
- reset - (optional) Whether to try to reset the form after the update
- callback - (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- YAHOO.ext.Element getEl()- -
Object getRenderer()- - - - - - - - - - - -
Object isUpdating()- -
void refresh(<Function> callback)- -
callback - (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- void setDefaultUrl(<String/Function> defaultUrl)- -
defaultUrl - The url or a function to call to get the url
- void setRenderer(<Object> renderer)- -
renderer - The object implementing the render() method
- void showLoading()- -
void startAutoRefresh(<Number> interval, <String/Function> url, <String/Object> params, <Function> callback, <Boolean> refreshNow)- -
interval - How often to update (in seconds).
- url - (optional) The url for this request or a function to call to get the url (Defaults to the last used url)
- params - (optional) The parameters to pass as either a url encoded string "¶m1=1¶m2=2" or as an object {YAHOO.ext.UpdateManager.prototype.param1 = 1; YAHOO.ext.UpdateManager.prototype.param2 = 2;}
- callback - (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- refreshNow - (optional) Whether to execute the refresh now, or wait the interval
- void stopAutoRefresh()- -
void update(<String/Function> url, <String/Object> params, <Function> callback, <Boolean> discardUrl)- -
url - The url for this request or a function to call to get the url
- params - (optional) The parameters to pass as either a url encoded string "param1=1¶m2=2" or as an object {YAHOO.ext.UpdateManager.prototype.param1 = 1; YAHOO.ext.UpdateManager.prototype.param2 = 2;}
- callback - (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- discardUrl - (optional) By default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url.
- Object - | - +--YAHOO.ext.grid.AbstractColumnModel -- -
-
This abstract class defines the ColumnModel interface and provides default implementations of the events required by the Grid.
-
Defined in AbstractColumnModel.js
-
| Field Summary | |
- YAHOO.util.CustomEvent |
- onHeaderChange
- - Fires when a header has changed - fireDirect sig: (this, columnIndex, newHeader) |
-
- YAHOO.util.CustomEvent |
- onHiddenChange
- - Fires when a column is hidden or unhidden - fireDirect sig: (this, columnIndex, hidden) |
-
- YAHOO.util.CustomEvent |
- onWidthChange
- - Fires when a column width is changed - fireDirect sig: (this, columnIndex, newWidth) |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.AbstractColumnModel
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- fireHeaderChange(colIndex, newHeader)
-
- - - - |
-
-
- void
-
- |
-
-
-
- fireHiddenChange(colIndex, hidden)
-
- - - - |
-
-
- void
-
- |
-
-
-
- fireWidthChange(colIndex, newWidth)
-
- - - - |
-
-
- Number
-
- |
-
-
-
- getColumnCount()
-
- - - Interface method - Returns the number of columns. - |
-
-
- String
-
- |
-
-
-
- getColumnHeader(<Number> col)
-
- - - Interface method - Returns the header for the specified column. - |
-
-
- Number
-
- |
-
-
-
- getColumnWidth(<Number> col)
-
- - - Interface method - Returns the width for the specified column. - |
-
-
- Function
-
- |
-
-
-
- getRenderer(<Number> col)
-
- - - Interface method - Returns the rendering (formatting) function defined for the column. - |
-
-
- Function
-
- |
-
-
-
- getSortType(<Number> col)
-
- - - Interface method - Returns the sorting comparison function defined for the column (defaults to sortTypes.none). - |
-
-
- Number
-
- |
-
-
-
- getTotalWidth()
-
- - - Interface method - Returns the total width of all columns. - |
-
-
- Boolean
-
- |
-
-
-
- isHidden(<Number> col)
-
- - - Interface method - Returns true if the specified column is hidden. - |
-
-
- Boolean
-
- |
-
-
-
- isSortable(<Number> col)
-
- - - Interface method - Returns true if the specified column is sortable. - |
-
| Field Detail | -
YAHOO.util.CustomEvent onHeaderChange-
YAHOO.util.CustomEvent onHiddenChange-
YAHOO.util.CustomEvent onWidthChange-
| - Constructor Detail - | -
YAHOO.ext.grid.AbstractColumnModel()- - - - - - - - - - - - - -
| - Method Detail - | -
void fireHeaderChange(colIndex, newHeader)- - - - - - - - - - - -
void fireHiddenChange(colIndex, hidden)- - - - - - - - - - - -
void fireWidthChange(colIndex, newWidth)- - - - - - - - - - - -
Number getColumnCount()- -
String getColumnHeader(<Number> col)- -
col - The column index
- Number getColumnWidth(<Number> col)- -
col - The column index
- Function getRenderer(<Number> col)- -
col - The column index
- Function getSortType(<Number> col)- -
col - The column index
- Number getTotalWidth()- -
Boolean isHidden(<Number> col)- -
col - The column index
- Boolean isSortable(<Number> col)- -
col - The column index
- Object - | - +--YAHOO.ext.grid.AbstractDataModel -- -
-
This abstract class provides default implementations of the events required by the Grid.
- It takes care of the creating the CustomEvents and provides some convenient methods for firing the events.
-
Defined in AbstractDataModel.js
-
| Field Summary | |
- Object |
- addListener
- - |
-
- Object |
- events
- - |
-
- Object |
- fireEvent
- - |
-
- YAHOO.util.CustomEvent |
- onCellUpdated
- - Fires when a cell is updated - fireDirect sig: (this, rowIndex, columnIndex) |
-
- YAHOO.util.CustomEvent |
- onRowsDeleted
- - Fires when rows are deleted - fireDirect sig: (this, firstRowIndex, lastRowIndex) |
-
- YAHOO.util.CustomEvent |
- onRowsInserted
- - Fires when a rows are inserted - fireDirect sig: (this, firstRowIndex, lastRowIndex) |
-
- YAHOO.util.CustomEvent |
- onRowsSorted
- - Fires when a sort has reordered the rows - fireDirect sig: (this, sortColumnIndex, - sortDirection = 'ASC' or 'DESC') |
-
- YAHOO.util.CustomEvent |
- onRowsUpdated
- - Fires when a rows are updated - fireDirect sig: (this, firstRowIndex, lastRowIndex) |
-
- YAHOO.util.CustomEvent |
- onTableDataChanged
- - Fires when all data needs to be revalidated - fireDirect sig: (thisd) |
-
- Object |
- removeListener
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.AbstractDataModel
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- fireCellUpdated(row, col)
-
- - - Notifies listeners that the value of the cell at [row, col] has been updated - |
-
-
- void
-
- |
-
-
-
- fireRowsDeleted(firstRow, lastRow)
-
- - - Notifies listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted - |
-
-
- void
-
- |
-
-
-
- fireRowsInserted(firstRow, lastRow)
-
- - - Notifies listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted - |
-
-
- void
-
- |
-
-
-
- fireRowsSorted(sortColumnIndex, sortDir, noRefresh)
-
- - - Notifies listeners that rows have been sorted and any indexes may be invalid - |
-
-
- void
-
- |
-
-
-
- fireRowsUpdated(firstRow, lastRow)
-
- - - Notifies listeners that rows in the range [firstRow, lastRow], inclusive, have been updated - |
-
-
- void
-
- |
-
-
-
- fireTableDataChanged()
-
- - - Notifies listeners that all data for the grid may have changed - use as a last resort. - |
-
-
- void
-
- |
-
-
-
- getRowCount()
-
- - - Empty interface method - Classes which extend AbstractDataModel should implement this method. - |
-
-
- void
-
- |
-
-
-
- getRowId(rowIndex)
-
- - - Empty interface method - Classes which extend AbstractDataModel should implement this method. - |
-
-
- Object
-
- |
-
-
-
- getSortState()
-
- - - Interface method to supply the view with info regarding the Grid's current sort state - if overridden, - this should return an object like this {YAHOO.ext.grid.AbstractDataModel.prototype.column = this;.sortColumn, YAHOO.ext.grid.AbstractDataModel.prototype.direction = this;.sortDir}. - |
-
-
- Object
-
- |
-
-
-
- getTotalRowCount()
-
- - - Empty interface method - Classes which extend AbstractDataModel should implement this method to support virtual row counts. - |
-
-
- void
-
- |
-
-
-
- getValueAt(rowIndex, colIndex)
-
- - - Empty interface method - Classes which extend AbstractDataModel should implement this method. - |
-
-
- Object
-
- |
-
-
-
- isPaged()
-
- - - - |
-
-
- void
-
- |
-
-
-
- setValueAt(value, rowIndex, colIndex)
-
- - - Empty interface method - Classes which extend AbstractDataModel should implement this method. - |
-
-
- void
-
- |
-
-
-
- sort(columnModel, columnIndex, direction, suppressEvent)
-
- - - Empty interface method - Classes which extend AbstractDataModel should implement this method. - |
-
| Field Detail | -
Object addListener-
Object events-
Object fireEvent-
YAHOO.util.CustomEvent onCellUpdated-
YAHOO.util.CustomEvent onRowsDeleted-
YAHOO.util.CustomEvent onRowsInserted-
YAHOO.util.CustomEvent onRowsSorted-
YAHOO.util.CustomEvent onRowsUpdated-
YAHOO.util.CustomEvent onTableDataChanged-
Object removeListener-
| - Constructor Detail - | -
YAHOO.ext.grid.AbstractDataModel()- - - - - - - - - - - - - -
| - Method Detail - | -
void fireCellUpdated(row, col)- -
void fireRowsDeleted(firstRow, lastRow)- -
void fireRowsInserted(firstRow, lastRow)- -
void fireRowsSorted(sortColumnIndex, sortDir, noRefresh)- -
void fireRowsUpdated(firstRow, lastRow)- -
void fireTableDataChanged()- -
void getRowCount()- -
void getRowId(rowIndex)- -
Object getSortState()- -
Object getTotalRowCount()- -
void getValueAt(rowIndex, colIndex)- -
Object isPaged()- - - - - - - - - - - -
void setValueAt(value, rowIndex, colIndex)- -
void sort(columnModel, columnIndex, direction, suppressEvent)- -
Object - | - +--YAHOO.ext.grid.CellEditor -- - -
- Defined in CellEditor.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.CellEditor
-
- (element)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- fitToCell(box)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getValue()
-
- - - - |
-
-
- void
-
- |
-
-
-
- hide()
-
- - - - |
-
-
- void
-
- |
-
-
-
- init(grid, bodyElement, callback)
-
- - - - |
-
-
- void
-
- |
-
-
-
- initEvents()
-
- - - - |
-
-
- void
-
- |
-
-
-
- setValue(value)
-
- - - - |
-
-
- void
-
- |
-
-
-
- show()
-
- - - - |
-
-
- void
-
- |
-
-
-
- startEditing(value, row, cell)
-
- - - - |
-
-
- void
-
- |
-
-
-
- stopEditing(focusCell)
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.grid.CellEditor(element)- - - - - - - - - - - - - -
| - Method Detail - | -
void fitToCell(box)- - - - - - - - - - - -
Object getValue()- - - - - - - - - - - -
void hide()- - - - - - - - - - - -
void init(grid, bodyElement, callback)- - - - - - - - - - - -
void initEvents()- - - - - - - - - - - -
void setValue(value)- - - - - - - - - - - -
void show()- - - - - - - - - - - -
void startEditing(value, row, cell)- - - - - - - - - - - -
void stopEditing(focusCell)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.CheckboxEditor -- - -
- Defined in CheckboxEditor.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.CheckboxEditor
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- fitToCell(box)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getValue()
-
- - - - |
-
-
- void
-
- |
-
-
-
- hide()
-
- - - - |
-
-
- void
-
- |
-
-
-
- initEvents()
-
- - - - |
-
-
- void
-
- |
-
-
-
- setValue(value)
-
- - - - |
-
-
- void
-
- |
-
-
-
- show()
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.grid.CheckboxEditor()- - - - - - - - - - - - - -
| - Method Detail - | -
void fitToCell(box)- - - - - - - - - - - -
Object getValue()- - - - - - - - - - - -
void hide()- - - - - - - - - - - -
void initEvents()- - - - - - - - - - - -
void setValue(value)- - - - - - - - - - - -
void show()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.DateEditor -- - -
- Defined in DateEditor.js
-
| Field Summary | |
- Object |
- allowBlank
- - |
-
- Object |
- blankText
- - |
-
- Object |
- disabledDates
- - |
-
- Object |
- disabledDatesText
- - |
-
- Object |
- disabledDays
- - |
-
- Object |
- disabledDaysText
- - |
-
- Object |
- format
- - |
-
- Object |
- invalidText
- - |
-
- Object |
- maxText
- - |
-
- Object |
- maxValue
- - |
-
- Object |
- minText
- - |
-
- Object |
- minValue
- - |
-
- Object |
- validationDelay
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.DateEditor
-
- (config)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- formatDate(date)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getValue()
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleMouseDown(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- hide()
-
- - - - |
-
-
- void
-
- |
-
-
-
- init(grid, bodyElement, callback)
-
- - - - |
-
-
- void
-
- |
-
-
-
- initEvents()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- parseDate(value)
-
- - - - |
-
-
- void
-
- |
-
-
-
- setValue(value)
-
- - - - |
-
-
- void
-
- |
-
-
-
- show()
-
- - - - |
-
-
- void
-
- |
-
-
-
- showCalendar(value)
-
- - - - |
-
-
- void
-
- |
-
-
-
- startEditing(value, row, cell)
-
- - - - |
-
-
- void
-
- |
-
-
-
- stopEditing(focusCell)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- validate()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- validator()
-
- - - - |
-
| Field Detail | -
Object allowBlank-
Object blankText-
Object disabledDates-
Object disabledDatesText-
Object disabledDays-
Object disabledDaysText-
Object format-
Object invalidText-
Object maxText-
Object maxValue-
Object minText-
Object minValue-
Object validationDelay-
| - Constructor Detail - | -
YAHOO.ext.grid.DateEditor(config)- - - - - - - - - - - - - -
| - Method Detail - | -
Object formatDate(date)- - - - - - - - - - - -
Object getValue()- - - - - - - - - - - -
void handleMouseDown(e)- - - - - - - - - - - -
void hide()- - - - - - - - - - - -
void init(grid, bodyElement, callback)- - - - - - - - - - - -
void initEvents()- - - - - - - - - - - -
Object parseDate(value)- - - - - - - - - - - -
void setValue(value)- - - - - - - - - - - -
void show()- - - - - - - - - - - -
void showCalendar(value)- - - - - - - - - - - -
void startEditing(value, row, cell)- - - - - - - - - - - -
void stopEditing(focusCell)- - - - - - - - - - - -
Object validate()- - - - - - - - - - - -
Object validator()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.AbstractColumnModel - | - +--YAHOO.ext.grid.DefaultColumnModel -- - -
-
This is the default implementation of a ColumnModel used by the Grid. It defines
- the columns in the grid.
-
Usage:
-
- var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
- var myColumns = [
- {header: "Ticker", width: 60, sortable: true, sortType: sort.asUCString},
- {header: "Company Name", width: 150, sortable: true, sortType: sort.asUCString},
- {header: "Market Cap.", width: 100, sortable: true, sortType: sort.asFloat},
- {header: "$ Sales", width: 100, sortable: true, sortType: sort.asFloat, renderer: money},
- {header: "Employees", width: 100, sortable: true, sortType: sort.asFloat}
- ];
- var colModel = new YAHOO.ext.grid.DefaultColumnModel(myColumns);
-
- | Field Summary | |
- Object |
- config
- - The config passed into the constructor |
-
- Boolean |
- defaultSortable
- - Default sortable of columns which have no sortable specified (defaults to false) |
-
- Number |
- defaultWidth
- - The width of columns which have no width specified (defaults to 100) |
-
- <static> Object |
- sortTypes
- - Defines the default sorting (casting?) comparison functions used when sorting data: - sortTypes.none - sorts data as it is without casting or parsing (the default) - sortTypes.asUCString - case insensitive string - sortTypes.asDate - attempts to parse data as a date - sortTypes.asFloat - sortTypes.asInt |
-
| Fields inherited from class YAHOO.ext.grid.AbstractColumnModel | -
- onWidthChange, onHeaderChange, onHiddenChange
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.DefaultColumnModel
-
- (config)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- getCellEditor(<Number> colIndex, <Number> rowIndex)
-
- - - Returns the editor defined for the cell/column. - |
-
-
- Number
-
- |
-
-
-
- getColumnCount()
-
- - - Returns the number of columns. - |
-
-
- String
-
- |
-
-
-
- getColumnHeader(<Number> col)
-
- - - Returns the header for the specified column. - |
-
-
- Number
-
- |
-
-
-
- getColumnWidth(<Number> col)
-
- - - Returns the width for the specified column. - |
-
-
- Number
-
- |
-
-
-
- getDataIndex(<Number> col)
-
- - - Returns the dataIndex for the specified column. - |
-
-
- Function
-
- |
-
-
-
- getRenderer(<Number> col)
-
- - - Returns the rendering (formatting) function defined for the column. - |
-
-
- Function
-
- |
-
-
-
- getSortType(<Number> col)
-
- - - Returns the sorting comparison function defined for the column (defaults to sortTypes.none). - |
-
-
- Number
-
- |
-
-
-
- getTotalWidth(<Boolean> includeHidden)
-
- - - Returns the total width of all columns. - |
-
-
- Boolean
-
- |
-
-
-
- isCellEditable(<Number> colIndex, <Number> rowIndex)
-
- - - Returns true if the cell is editable. - |
-
-
- Boolean
-
- |
-
-
-
- isHidden(<Number> colIndex)
-
- - - Returns true if the column is hidden. - |
-
-
- Boolean
-
- |
-
-
-
- isSortable(<Number> col)
-
- - - Returns true if the specified column is sortable. - |
-
-
- void
-
- |
-
-
-
- setColumnHeader(<Number> col, <String> header)
-
- - - Sets the header for a column. - |
-
-
- void
-
- |
-
-
-
- setColumnWidth(<Number> col, <Number> width, suppressEvent)
-
- - - Sets the width for a column. - |
-
-
- void
-
- |
-
-
-
- setDataIndex(<Number> col, <Number> dataIndex)
-
- - - Sets the dataIndex for a column. - |
-
-
- void
-
- |
-
-
-
- setEditable(<Number> col, <Boolean> editable)
-
- - - Sets if a column is editable. - |
-
-
- void
-
- |
-
-
-
- setEditor(<Number> col, <Object> editor)
-
- - - Sets the editor for a column. - |
-
-
- void
-
- |
-
-
-
- setHidden(<Number> colIndex, hidden)
-
- - - Sets if a column is hidden. - |
-
-
- void
-
- |
-
-
-
- setRenderer(<Number> col, <Function> fn)
-
- - - Sets the rendering (formatting) function for a column. - |
-
-
- void
-
- |
-
-
-
- setSortType(<Number> col, <Function> fn)
-
- - - Sets the sorting comparison function for a column. - |
-
-
- <static> Object
-
- |
-
-
-
- defaultRenderer(value)
-
- - - Default empty rendering function - |
-
| Methods inherited from class YAHOO.ext.grid.AbstractColumnModel | -
-
-fireWidthChange, fireHeaderChange, fireHiddenChange
- |
-
| Field Detail | -
Object config-
Boolean defaultSortable-
Number defaultWidth-
<static> Object sortTypes-
| - Constructor Detail - | -
YAHOO.ext.grid.DefaultColumnModel(config)- - - - - - - - - - - - - -
| - Method Detail - | -
Object getCellEditor(<Number> colIndex, <Number> rowIndex)- -
colIndex - The column index
- rowIndex - The row index
- Number getColumnCount()- -
String getColumnHeader(<Number> col)- -
col - The column index
- Number getColumnWidth(<Number> col)- -
col - The column index
- Number getDataIndex(<Number> col)- -
col - The column index
- Function getRenderer(<Number> col)- -
col - The column index
- Function getSortType(<Number> col)- -
col - The column index
- Number getTotalWidth(<Boolean> includeHidden)- -
includeHidden - True to include hidden column widths
- Boolean isCellEditable(<Number> colIndex, <Number> rowIndex)- -
colIndex - The column index
- rowIndex - The row index
- Boolean isHidden(<Number> colIndex)- -
colIndex - The column index
- Boolean isSortable(<Number> col)- -
col - The column index
- void setColumnHeader(<Number> col, <String> header)- -
col - The column index
- header - The new header
- void setColumnWidth(<Number> col, <Number> width, suppressEvent)- -
col - The column index
- width - The new width
- void setDataIndex(<Number> col, <Number> dataIndex)- -
col - The column index
- dataIndex - The new dataIndex
- void setEditable(<Number> col, <Boolean> editable)- -
col - The column index
- editable - True if the column is editable
- void setEditor(<Number> col, <Object> editor)- -
col - The column index
- editor - The editor object
- void setHidden(<Number> colIndex, hidden)- -
colIndex - The column index
- void setRenderer(<Number> col, <Function> fn)- -
col - The column index
- fn -
- void setSortType(<Number> col, <Function> fn)- -
col - The column index
- fn -
- <static> Object defaultRenderer(value)- -
Object - | - +--YAHOO.ext.grid.AbstractDataModel - | - +--YAHOO.ext.grid.DefaultDataModel -- -
-
This is the default implementation of a DataModel used by the Grid. It works
- with multi-dimensional array based data. Using the event system in the base class
- YAHOO.ext.grid.AbstractDataModel, all updates to this DataModel are automatically
- reflected in the user interface.
-
Usage:
-
- var myData = [
- ["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
- ["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"]
- ];
- var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData);
-
- | Fields inherited from class YAHOO.ext.grid.AbstractDataModel | -
- onCellUpdated, onTableDataChanged, onRowsDeleted, onRowsInserted, onRowsUpdated, onRowsSorted, events, addListener, removeListener, fireEvent
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.DefaultDataModel
-
- (data)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Number
-
- |
-
-
-
- addRow(<Array> cellValues)
-
- - - Adds a row to the dataset. - |
-
-
- void
-
- |
-
-
-
- applySort(suppressEvent)
-
- - - Applies the last used sort to the current data. - |
-
-
- Number
-
- |
-
-
-
- filter(<Object> query)
-
- - - Filter the DataModel rows by the query defined in spec, see query() for more details - on the query spec. - |
-
-
- Array
-
- |
-
-
-
- getRow(rowIndex)
-
- - - Returns the column data for the specified row. - |
-
-
- Number
-
- |
-
-
-
- getRowCount()
-
- - - Returns the number of rows in the dataset - |
-
-
- Number
-
- |
-
-
-
- getRowId(rowIndex)
-
- - - Returns the ID of the specified row. - |
-
-
- Array
-
- |
-
-
-
- getRows(<Array> indexes)
-
- - - Returns the column data for the specified rows as a - multi-dimensional array: rows[3][0] would give you the value of row 4, column 0. - |
-
-
- Object
-
- |
-
-
-
- getValueAt(<Number> rowIndex, <Number> colIndex)
-
- - - Returns the value at the specified data position - |
-
-
- Number
-
- |
-
-
-
- insertRow(<Number> index, <Array> cellValues)
-
- - - Inserts a row a the specified location in the dataset. - |
-
-
- Array
-
- |
-
-
-
- query(<Object> spec, <Boolean> returnUnmatched)
-
- - - Query the DataModel rows by the filters defined in spec, for example... - |
-
-
- void
-
- |
-
-
-
- removeRow(<Number> index)
-
- - - Remove a row. - |
-
-
- void
-
- |
-
-
-
- setDefaultSort(columnModel, columnIndex, direction)
-
- - - - |
-
-
- void
-
- |
-
-
-
- setValueAt(<Object> value, <Number> rowIndex, <Number> colIndex)
-
- - - Sets the specified value at the specified data position - |
-
-
- void
-
- |
-
-
-
- sort(<YAHOO.ext.grid.DefaultColumnModel> columnModel, <Number> columnIndex, <String> direction, suppressEvent)
-
- - - Sorts the data by the specified column - Uses the sortType specified for the column in the passed columnModel. - |
-
| Methods inherited from class YAHOO.ext.grid.AbstractDataModel | -
-
-fireCellUpdated, fireTableDataChanged, fireRowsDeleted, fireRowsInserted, fireRowsUpdated, fireRowsSorted, getSortState, getTotalRowCount, isPaged
- |
-
| - Constructor Detail - | -
YAHOO.ext.grid.DefaultDataModel(data)- - - - - - - - - - - - - -
| - Method Detail - | -
Number addRow(<Array> cellValues)- -
cellValues - The array of values for the new row
- void applySort(suppressEvent)- -
Number filter(<Object> query)- -
query - The query spec query()
- Array getRow(rowIndex)- -
Number getRowCount()- -
Number getRowId(rowIndex)- -
Array getRows(<Array> indexes)- -
indexes - The row indexes to fetch
- Object getValueAt(<Number> rowIndex, <Number> colIndex)- -
rowIndex -
- colIndex -
- Number insertRow(<Number> index, <Array> cellValues)- -
index - The index where the row should be inserted
- cellValues - The array of values for the new row
- Array query(<Object> spec, <Boolean> returnUnmatched)- -
- // column 1 starts with Jack, column 2 filtered by myFcn, column 3 equals 'Fred'
- dataModel.filter({1: /^Jack.+/i}, 2: myFcn, 3: 'Fred'});
-
-
-
-
-
- spec - The spec is generally an object literal consisting of column index and filter type. The filter type can be a string/number (exact match), a regular expression to test using String.search() or a function to call. If it's a function, it will be called with the value for the specified column and an array of the all column values for that row: yourFcn(value, columnData). If it returns anything other than true, the row is not a match.
- returnUnmatched - True to return rows which don't match the query instead of rows that do match
- void removeRow(<Number> index)- -
index -
- void setDefaultSort(columnModel, columnIndex, direction)- - - - - - - - - - - -
void setValueAt(<Object> value, <Number> rowIndex, <Number> colIndex)- -
value - The new value
- rowIndex -
- colIndex -
- void sort(<YAHOO.ext.grid.DefaultColumnModel> columnModel, <Number> columnIndex, <String> direction, suppressEvent)- -
columnModel - The ColumnModel for this dataset
- columnIndex - The column index to sort by
- direction - The direction of the sort ('DESC' or 'ASC')
- Object - | - +--YAHOO.ext.grid.DefaultSelectionModel -- -
-
The default SelectionModel used by YAHOO.ext.grid.Grid.
- It supports multiple selections and keyboard selection/navigation.
-
Defined in SelectionModel.js
-
| Field Summary | |
- Object |
- addListener
- - |
-
- Object |
- events
- - |
-
- Object |
- fireEvent
- - |
-
- Object |
- locked
- - |
-
- YAHOO.util.CustomEvent |
- onRowSelect
- - Fires when a row is selected or deselected - fireDirect sig: (this, row, isSelected) |
-
- YAHOO.util.CustomEvent |
- onSelectionChange
- - Fires when the selection changes on the Grid - fireDirect sig: (this, selectedRows[], selectedRowIds[]) |
-
- Object |
- removeListener
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.DefaultSelectionModel
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- clearSelections()
-
- - - Clears all selections. - |
-
-
- void
-
- |
-
-
-
- deselectRange(<Number/HTMLElement> startRow, <Number/HTMLElement> endRow)
-
- - - Deselects a range of rows. - |
-
-
- void
-
- |
-
-
-
- deselectRow(<Number/HTMLElement> row)
-
- - - Deselects a row. - |
-
-
- void
-
- |
-
-
-
- focusRow(<HTMLElement> row)
-
- - - Deprecated. - |
-
-
- Number
-
- |
-
-
-
- getCount()
-
- - - Gets the number of selected rows. - |
-
-
- Array
-
- |
-
-
-
- getSelectedRowIds()
-
- - - Returns the selected row ids. - |
-
-
- Array
-
- |
-
-
-
- getSelectedRows()
-
- - - Returns the selected rows. - |
-
-
- Boolean
-
- |
-
-
-
- hasSelection()
-
- - - Returns True if there is a selection. - |
-
-
- Object
-
- |
-
-
-
- isLocked()
-
- - - - |
-
-
- Boolean
-
- |
-
-
-
- isSelectable(<HTMLElement> row)
-
- - - Returns True if the specified row is selectable. - |
-
-
- Boolean
-
- |
-
-
-
- isSelected(<HTMLElement> row)
-
- - - Returns True if the specified row is selected. - |
-
-
- void
-
- |
-
-
-
- lock()
-
- - - - |
-
-
- void
-
- |
-
-
-
- selectAll()
-
- - - Selects all rows. - |
-
-
- void
-
- |
-
-
-
- selectFirstRow()
-
- - - Selects the first row in the grid. - |
-
-
- void
-
- |
-
-
-
- selectNext(<Boolean> keepExisting)
-
- - - Selects the row immediately following the last selected row. - |
-
-
- void
-
- |
-
-
-
- selectPrevious(<Boolean> keepExisting)
-
- - - Selects the row that precedes the last selected row. - |
-
-
- void
-
- |
-
-
-
- selectRange(<Number/HTMLElement> startRow, <Number/HTMLElement> endRow, <Boolean> keepExisting)
-
- - - Selects a range of rows. - |
-
-
- void
-
- |
-
-
-
- selectRow(<Number/HTMLElement> row, <Boolean> keepExisting)
-
- - - Selects a row. - |
-
-
- void
-
- |
-
-
-
- selectRows(<Array> rows, <Boolean> keepExisting)
-
- - - Selects multiple rows. - |
-
-
- void
-
- |
-
-
-
- selectRowsById(<String/Array> id, <Boolean> keepExisting)
-
- - - Set the selected rows by their ID(s). - |
-
-
- void
-
- |
-
-
-
- unlock()
-
- - - - |
-
| Field Detail | -
Object addListener-
Object events-
Object fireEvent-
Object locked-
YAHOO.util.CustomEvent onRowSelect-
YAHOO.util.CustomEvent onSelectionChange-
Object removeListener-
| - Constructor Detail - | -
YAHOO.ext.grid.DefaultSelectionModel()- - - - - - - - - - - - - -
| - Method Detail - | -
void clearSelections()- -
void deselectRange(<Number/HTMLElement> startRow, <Number/HTMLElement> endRow)- -
startRow - The row or index of the first row in the range
- endRow - The row or index of the last row in the range
- void deselectRow(<Number/HTMLElement> row)- -
row - The row or index of the row to deselect
- void focusRow(<HTMLElement> row)- -
row - The row to focus
- Number getCount()- -
Array getSelectedRowIds()- -
Array getSelectedRows()- -
Boolean hasSelection()- -
Object isLocked()- - - - - - - - - - - -
Boolean isSelectable(<HTMLElement> row)- -
row - The row to check
- Boolean isSelected(<HTMLElement> row)- -
row - The row to check
- void lock()- - - - - - - - - - - -
void selectAll()- -
void selectFirstRow()- -
void selectNext(<Boolean> keepExisting)- -
keepExisting - (optional) True to retain existing selections
- void selectPrevious(<Boolean> keepExisting)- -
keepExisting - (optional) True to retain existing selections
- void selectRange(<Number/HTMLElement> startRow, <Number/HTMLElement> endRow, <Boolean> keepExisting)- -
startRow - The row or index of the first row in the range
- endRow - The row or index of the last row in the range
- keepExisting - (optional) True to retain existing selections
- void selectRow(<Number/HTMLElement> row, <Boolean> keepExisting)- -
row - The row or index of the row to select
- keepExisting - (optional) True to retain existing selections
- void selectRows(<Array> rows, <Boolean> keepExisting)- -
rows - Array of the rows or indexes of the row to select
- keepExisting - (optional) True to retain existing selections
- void selectRowsById(<String/Array> id, <Boolean> keepExisting)- -
id - The id(s) to select
- keepExisting - (optional) True to retain existing selections
- void unlock()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.DefaultSelectionModel - | - +--YAHOO.ext.grid.DisableSelectionModel -- - -
-
Extends YAHOO.ext.grid.DefaultSelectionModel to disable row selection.
-
Defined in SelectionModel.js
-
| Fields inherited from class YAHOO.ext.grid.DefaultSelectionModel | -
- onRowSelect, onSelectionChange, events, locked, addListener, removeListener, fireEvent
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.DisableSelectionModel
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- initEvents()
-
- - - - |
-
| Methods inherited from class YAHOO.ext.grid.DefaultSelectionModel | -
-
-lock, unlock, isLocked, selectRowsById, getCount, selectFirstRow, selectNext, selectPrevious, getSelectedRows, getSelectedRowIds, clearSelections, selectAll, hasSelection, isSelected, isSelectable, focusRow, selectRow, selectRows, deselectRow, selectRange, deselectRange
- |
-
| - Constructor Detail - | -
YAHOO.ext.grid.DisableSelectionModel()- - - - - - - - - - - - - -
| - Method Detail - | -
void initEvents()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.EditorAndSelectionModel -- - -
- Defined in EditorSelectionModel.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.EditorAndSelectionModel
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- initEvents()
-
- - - - |
-
-
- void
-
- |
-
-
-
- onCellDblClick(grid, rowIndex, colIndex)
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.grid.EditorAndSelectionModel()- - - - - - - - - - - - - -
| - Method Detail - | -
void initEvents()- - - - - - - - - - - -
void onCellDblClick(grid, rowIndex, colIndex)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.DefaultSelectionModel - | - +--YAHOO.ext.grid.EditorSelectionModel -- - -
-
Extends YAHOO.ext.grid.DefaultSelectionModel to enable cell navigation.
-
Defined in EditorSelectionModel.js
-
| Field Summary | |
- Number |
- clicksToActivateCell
- - Number of clicks to activate a cell (for editing) - valid values are 1 or 2 |
-
- Object |
- controlForArrowNavigation
- - |
-
- Object |
- disableArrowNavigation
- - |
-
| Fields inherited from class YAHOO.ext.grid.DefaultSelectionModel | -
- onRowSelect, onSelectionChange, events, locked, addListener, removeListener, fireEvent
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.EditorSelectionModel
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- activate(row, cell)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- allowArrowNav(e)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getEditorCellAfter(cell, spanRows)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getEditorCellBefore(cell, spanRows)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onCellClick(grid, rowIndex, colIndex)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onCellDblClick(grid, rowIndex, colIndex)
-
- - - - |
-
| Methods inherited from class YAHOO.ext.grid.DefaultSelectionModel | -
-
-lock, unlock, isLocked, selectRowsById, getCount, selectFirstRow, selectNext, selectPrevious, getSelectedRows, getSelectedRowIds, clearSelections, selectAll, hasSelection, isSelected, isSelectable, focusRow, selectRow, selectRows, deselectRow, selectRange, deselectRange
- |
-
| Field Detail | -
Number clicksToActivateCell-
Object controlForArrowNavigation-
Object disableArrowNavigation-
| - Constructor Detail - | -
YAHOO.ext.grid.EditorSelectionModel()- - - - - - - - - - - - - -
| - Method Detail - | -
void activate(row, cell)- - - - - - - - - - - -
Object allowArrowNav(e)- - - - - - - - - - - -
Object getEditorCellAfter(cell, spanRows)- - - - - - - - - - - -
Object getEditorCellBefore(cell, spanRows)- - - - - - - - - - - -
void onCellClick(grid, rowIndex, colIndex)- - - - - - - - - - - -
void onCellDblClick(grid, rowIndex, colIndex)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.Grid -- - -
-
This class represents the primary interface of a component based grid control.
-
Usage:
- var grid = new YAHOO.ext.grid.Grid('my-container-id', dataModel, columnModel);
- // set any options
- grid.render();
-
- | Field Summary | |
- Object |
- allowTextSelectionPattern
- - A regular expression defining tagNames - allowed to have text selection (Defaults to /INPUT|TEXTAREA/i) |
-
- Boolean |
- autoSizeColumns
- - True to automatically resize the columns to fit their content on initial render |
-
- Boolean |
- autoSizeHeaders
- - True to measure headers with column data when auto sizing columns |
-
- String |
- ddText
- - Configures the text is the drag proxy (defaults to "%0 selected row(s)"). |
-
- Boolean |
- enableDragDrop
- - True to enable drag and drop of rows |
-
- Number |
- maxRowsToMeasure
- - If autoSizeColumns is on, maxRowsToMeasure can be used to limit the number of - rows measured to get a columns size - defaults to 0 (all rows). |
-
- Number |
- minColumnWidth
- - The minimum width a column can be resized to. |
-
- Boolean |
- stripeRows
- - True to stripe the rows (default is true) |
-
- Boolean |
- trackMouseOver
- - True to highlight rows when the mouse is over (default is false) |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.Grid
-
- (<String/HTMLElement/YAHOO.ext.Element> container, <Object> dataModel, <Object> colModel, <Object> selectionModel)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- addListener(<String> eventName, <Function> fn, <Object> scope, <boolean> override)
-
- - - Adds a listener for one of the many defined grid events - |
-
-
- void
-
- |
-
-
-
- autoSize()
-
- - - Causes the grid to manually recalculate it's dimensions. - |
-
-
- void
-
- |
-
-
-
- bindToField(fieldId)
-
- - - Binds this grid to the field with the specified id. - |
-
-
- void
-
- |
-
-
-
- clearSelections()
-
- - - Convenience method for getSelectionModel().clearSelections() - - See YAHOO.ext.grid.DefaultSelectionModel.clearSelections() for more details. - |
-
-
- HTMLElement
-
- |
-
-
-
- getCellAfter(<HTMLElement> cell, <Boolean> includeHidden)
-
- - - Returns the cell that comes after the specified cell - text nodes are skipped. - |
-
-
- HTMLElement
-
- |
-
-
-
- getCellBefore(<HTMLElement> cell, <Boolean> includeHidden)
-
- - - Returns the cell that comes before the specified cell - text nodes are skipped. - |
-
-
- HTMLElement
-
- |
-
-
-
- getCellFromChild(<HTMLElement> childEl)
-
- - - Returns the cell that contains the specified child element. - |
-
-
- Object
-
- |
-
-
-
- getColumnModel()
-
- - - Returns the grid's ColumnModel. - |
-
-
- Object
-
- |
-
-
-
- getDataModel()
-
- - - Returns the grid's DataModel. - |
-
-
- String
-
- |
-
-
-
- getDragDropText()
-
- - - Called to get grid's drag proxy text, by default returns this.ddText. - |
-
-
- HTMLElement
-
- |
-
-
-
- getFirstCell(<HTMLElement> row, <Boolean> includeHidden)
-
- - - Returns the first cell for the row - text nodes and hidden columns are skipped. - |
-
-
- HTMLElement
-
- |
-
-
-
- getHeaderFromChild(<HTMLElement> childEl)
-
- - - Returns the header element that contains the specified child element. - |
-
-
- HTMLElement
-
- |
-
-
-
- getLastCell(<HTMLElement> row, <Boolean> includeHidden)
-
- - - Returns the last cell for the row - text nodes and hidden columns are skipped. - |
-
-
- HTMLElement
-
- |
-
-
-
- getRow(index)
-
- - - Returns the table row at the specified index - |
-
-
- HTMLElement
-
- |
-
-
-
- getRowAfter(<HTMLElement> row)
-
- - - Returns the row that comes after the specified row - text nodes are skipped. - |
-
-
- HTMLElement
-
- |
-
-
-
- getRowBefore(<HTMLElement> row)
-
- - - Returns the row that comes before the specified row - text nodes are skipped. - |
-
-
- HTMLElement
-
- |
-
-
-
- getRowFromChild(<HTMLElement> childEl)
-
- - - Returns the row that contains the specified child element. - |
-
-
- HtmlElement/Array
-
- |
-
-
-
- getRowsById(id)
-
- - - Returns the rows that have the specified id(s). - |
-
-
- Object
-
- |
-
-
-
- getSelectedRow()
-
- - - Convenience method for getSelectionModel().getSelectedRows()[0] - - See YAHOO.ext.grid.DefaultSelectionModel.getSelectedRows() for more details. - |
-
-
- Object
-
- |
-
-
-
- getSelectedRowId()
-
- - - Convenience method for getSelectionModel().getSelectedRowIds()[0] - - See YAHOO.ext.grid.DefaultSelectionModel.getSelectedRowIds() for more details. - |
-
-
- Object
-
- |
-
-
-
- getSelectedRowIds()
-
- - - Convenience method for getSelectionModel().getSelectedRowIds() - - See YAHOO.ext.grid.DefaultSelectionModel.getSelectedRowIds() for more details. - |
-
-
- Number
-
- |
-
-
-
- getSelectedRowIndex()
-
- - - Gets the first selected row or -1 if none are selected - |
-
-
- Array
-
- |
-
-
-
- getSelectedRowIndexes()
-
- - - Get the selected row indexes - |
-
-
- Object
-
- |
-
-
-
- getSelectedRows()
-
- - - Convenience method for getSelectionModel().getSelectedRows() - - See YAHOO.ext.grid.DefaultSelectionModel.getSelectedRows() for more details. - |
-
-
- Object
-
- |
-
-
-
- getSelectionCount()
-
- - - Convenience method for getSelectionModel().getCount() - - See YAHOO.ext.grid.DefaultSelectionModel.getCount() for more details. - |
-
-
- Object
-
- |
-
-
-
- getSelectionModel()
-
- - - Returns the grid's SelectionModel. - |
-
-
- Object
-
- |
-
-
-
- getView()
-
- - - Returns the grid's GridView object. - |
-
-
- Object
-
- |
-
-
-
- hasSelection()
-
- - - Convenience method for getSelectionModel().hasSelection() - - See YAHOO.ext.grid.DefaultSelectionModel.hasSelection() for more details. - |
-
-
- void
-
- |
-
-
-
- on(eventName, fn, scope, override)
-
- - - Shorthand for addListener - |
-
-
- void
-
- |
-
-
-
- readField()
-
- - - Causes the grid to read and select the ids from the bound field - See bindToField(). - |
-
-
- void
-
- |
-
-
-
- removeListener(eventName, fn, scope)
-
- - - - |
-
-
- void
-
- |
-
-
-
- render()
-
- - - Called once after all setup has been completed and the grid is ready to be rendered. - |
-
-
- void
-
- |
-
-
-
- scrollTo(<Number/HTMLElement> row)
-
- - - Scrolls the grid to the specified row - |
-
-
- void
-
- |
-
-
-
- selectAll()
-
- - - Convenience method for getSelectionModel().selectAll() - - See YAHOO.ext.grid.DefaultSelectionModel.selectAll() for more details. - |
-
-
- void
-
- |
-
-
-
- setCellValue(value, rowIndex, colIndex)
-
- - - - |
-
-
- void
-
- |
-
-
-
- startEditing(rowIndex, colIndex)
-
- - - Starts editing the specified for the specified row/column - |
-
-
- void
-
- |
-
-
-
- stopEditing()
-
- - - Stops any active editing - |
-
| Field Detail | -
Object allowTextSelectionPattern-
/INPUT|TEXTAREA/i)
-
- Boolean autoSizeColumns-
Boolean autoSizeHeaders-
String ddText-
Boolean enableDragDrop-
Number maxRowsToMeasure-
Number minColumnWidth-
Boolean stripeRows-
Boolean trackMouseOver-
| - Constructor Detail - | -
YAHOO.ext.grid.Grid(<String/HTMLElement/YAHOO.ext.Element> container, <Object> dataModel, <Object> colModel, <Object> selectionModel)- - - - -
container - The element into which this grid will be rendered - The container MUST have some type of size defined for the grid to fill. The container will be automatically set to position relative if it isn't already.
- dataModel - The data model to bind to
- colModel - The column model with info about this grid's columns
- selectionModel - (optional) The selection model for this grid (defaults to DefaultSelectionModel)
- | - Method Detail - | -
void addListener(<String> eventName, <Function> fn, <Object> scope, <boolean> override)- -
eventName - The type of event to listen for
- fn - The method the event invokes
- scope - (optional) An arbitrary object that will be passed as a parameter to the handler
- override - (optional) If true, the obj passed in becomes the execution scope of the listener
- void autoSize()- -
void bindToField(fieldId)- -
The - id of the field to bind to
- void clearSelections()- -
HTMLElement getCellAfter(<HTMLElement> cell, <Boolean> includeHidden)- -
cell -
- includeHidden -
- HTMLElement getCellBefore(<HTMLElement> cell, <Boolean> includeHidden)- -
cell -
- includeHidden -
- HTMLElement getCellFromChild(<HTMLElement> childEl)- -
childEl -
- Object getColumnModel()- -
Object getDataModel()- -
String getDragDropText()- -
HTMLElement getFirstCell(<HTMLElement> row, <Boolean> includeHidden)- -
row -
- includeHidden -
- HTMLElement getHeaderFromChild(<HTMLElement> childEl)- -
childEl -
- HTMLElement getLastCell(<HTMLElement> row, <Boolean> includeHidden)- -
row -
- includeHidden -
- HTMLElement getRow(index)- -
HTMLElement getRowAfter(<HTMLElement> row)- -
row -
- HTMLElement getRowBefore(<HTMLElement> row)- -
row -
- HTMLElement getRowFromChild(<HTMLElement> childEl)- -
childEl -
- HtmlElement/Array getRowsById(id)- -
An - id to find or an array of ids
- Object getSelectedRow()- -
Object getSelectedRowId()- -
Object getSelectedRowIds()- -
Number getSelectedRowIndex()- -
Array getSelectedRowIndexes()- -
Object getSelectedRows()- -
Object getSelectionCount()- -
Object getSelectionModel()- -
Object getView()- -
Object hasSelection()- -
void on(eventName, fn, scope, override)- -
void readField()- -
void removeListener(eventName, fn, scope)- - - - - - - - - - - -
void render()- -
void scrollTo(<Number/HTMLElement> row)- -
row - The row object or index of the row
- void selectAll()- -
void setCellValue(value, rowIndex, colIndex)- - - - - - - - - - - -
void startEditing(rowIndex, colIndex)- -
void stopEditing()- -
Object - | - +--YAHOO.util.DDProxy - | - +--YAHOO.ext.grid.GridDD -- - -
-
Custom implementation of YAHOO.util.DDProxy used internally by the grid
-
Defined in GridDD.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.GridDD
-
- (grid, bwrap)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- autoOffset(iPageX, iPageY)
-
- - - - |
-
-
- void
-
- |
-
-
-
- endDrag(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleClick(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleMouseDown(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onDragDrop(e, id)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onDragEnter(e, id)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onDragOut(e, id)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onDragOver(e, id)
-
- - - - |
-
-
- void
-
- |
-
-
-
- setDropStatus(<Boolean> dropStatus)
-
- - - Updates the DD visual element to allow/not allow a drop - |
-
-
- void
-
- |
-
-
-
- startDrag(e)
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.grid.GridDD(grid, bwrap)- - - - - - - - - - - - - -
| - Method Detail - | -
void autoOffset(iPageX, iPageY)- - - - - - - - - - - -
void endDrag(e)- - - - - - - - - - - -
void handleClick(e)- - - - - - - - - - - -
void handleMouseDown(e)- - - - - - - - - - - -
void onDragDrop(e, id)- - - - - - - - - - - -
void onDragEnter(e, id)- - - - - - - - - - - -
void onDragOut(e, id)- - - - - - - - - - - -
void onDragOver(e, id)- - - - - - - - - - - -
void setDropStatus(<Boolean> dropStatus)- -
dropStatus - True if drop is allowed on the target
- void startDrag(e)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.GridView -- - -
-
Default UI code used internally by the Grid. Documentation to come.
-
Defined in GridView.js
-
| Field Summary | |
- YAHOO.util.CustomEvent |
- onScroll
- - Fires when the ViewPort is scrolled - fireDirect sig: (this, scrollLeft, scrollTop) |
-
- Object |
- scrollbarMode
- - |
-
- <static> Object |
- SCROLLBARS_OVERLAP
- - |
-
- <static> Object |
- SCROLLBARS_UNDER
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.GridView
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- adjustForScroll(disableDelay)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- appendFooter(parentEl)
-
- - - - |
-
-
- void
-
- |
-
-
-
- autoSizeColumn(colIndex, forceMinSize)
-
- - - - |
-
-
- void
-
- |
-
-
-
- autoSizeColumns()
-
- - - - |
-
-
- void
-
- |
-
-
-
- buildIndexMap()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- calcColumnWidth(colIndex, maxRowsToMeasure)
-
- - - - |
-
-
- void
-
- |
-
-
-
- deleteRows(dataModel, firstRow, lastRow)
-
- - - - |
-
-
- void
-
- |
-
-
-
- ensureVisible(row, disableDelay)
-
- - - - |
-
-
- void
-
- |
-
-
-
- fireScroll(scrollLeft, scrollTop)
-
- - - - |
-
-
- void
-
- |
-
-
-
- focusRow(row)
-
- - - - |
-
-
- void
-
- |
-
-
-
- forceScrollUpdate()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getBodyTable()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getCellAtPoint(x, y)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getColumnIndexByDataIndex(dataIndex)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getColumnRenderers()
-
- - - Utility method that gets an array of the cell renderers - |
-
-
- Object
-
- |
-
-
-
- getDataIndexes()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getRowHeight()
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleHiddenChange(colModel, colIndex, hidden)
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleScroll()
-
- - - - |
-
-
- void
-
- |
-
-
-
- handleSort(dataModel, sortColumnIndex, sortDir, noRefresh)
-
- - - - |
-
-
- void
-
- |
-
-
-
- hideColumn(colIndex)
-
- - - - |
-
-
- void
-
- |
-
-
-
- init(grid)
-
- - - - |
-
-
- void
-
- |
-
-
-
- insertRows(dataModel, firstRow, lastRow)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onColumnSplitterMoved(splitter, newSize)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- render()
-
- - - - |
-
-
- void
-
- |
-
-
-
- renderRow(dataModel, row, rowIndex, colCount, renderers, dindexes)
-
- - - - |
-
-
- void
-
- |
-
-
-
- renderRows(dataModel)
-
- - - - |
-
-
- void
-
- |
-
-
-
- setCSSWidth(colIndex, width, pos)
-
- - - - |
-
-
- void
-
- |
-
-
-
- syncScroll()
-
- - - - |
-
-
- void
-
- |
-
-
-
- unhideColumn(colIndex)
-
- - - - |
-
-
- void
-
- |
-
-
-
- updateBodyHeight()
-
- - - - |
-
-
- void
-
- |
-
-
-
- updateCell(dataModel, rowIndex, dataIndex)
-
- - - - |
-
-
- void
-
- |
-
-
-
- updateColumns()
-
- - - - |
-
-
- void
-
- |
-
-
-
- updateHeaders()
-
- - - - |
-
-
- void
-
- |
-
-
-
- updateHeaderSortState()
-
- - - - |
-
-
- void
-
- |
-
-
-
- updateRowIndexes(firstRow, lastRow)
-
- - - - |
-
-
- void
-
- |
-
-
-
- updateRows(dataModel, firstRow, lastRow)
-
- - - - |
-
-
- void
-
- |
-
-
-
- updateWrapHeight()
-
- - - - |
-
| Field Detail | -
YAHOO.util.CustomEvent onScroll-
Object scrollbarMode-
<static> Object SCROLLBARS_OVERLAP-
<static> Object SCROLLBARS_UNDER-
| - Constructor Detail - | -
YAHOO.ext.grid.GridView()- - - - - - - - - - - - - -
| - Method Detail - | -
void adjustForScroll(disableDelay)- - - - - - - - - - - -
Object appendFooter(parentEl)- - - - - - - - - - - -
void autoSizeColumn(colIndex, forceMinSize)- - - - - - - - - - - -
void autoSizeColumns()- - - - - - - - - - - -
void buildIndexMap()- - - - - - - - - - - -
Object calcColumnWidth(colIndex, maxRowsToMeasure)- - - - - - - - - - - -
void deleteRows(dataModel, firstRow, lastRow)- - - - - - - - - - - -
void ensureVisible(row, disableDelay)- - - - - - - - - - - -
void fireScroll(scrollLeft, scrollTop)- - - - - - - - - - - -
void focusRow(row)- - - - - - - - - - - -
void forceScrollUpdate()- - - - - - - - - - - -
Object getBodyTable()- - - - - - - - - - - -
Object getCellAtPoint(x, y)- - - - - - - - - - - -
Object getColumnIndexByDataIndex(dataIndex)- - - - - - - - - - - -
Object getColumnRenderers()- -
Object getDataIndexes()- - - - - - - - - - - -
Object getRowHeight()- - - - - - - - - - - -
void handleHiddenChange(colModel, colIndex, hidden)- - - - - - - - - - - -
void handleScroll()- - - - - - - - - - - -
void handleSort(dataModel, sortColumnIndex, sortDir, noRefresh)- - - - - - - - - - - -
void hideColumn(colIndex)- - - - - - - - - - - -
void init(grid)- - - - - - - - - - - -
void insertRows(dataModel, firstRow, lastRow)- - - - - - - - - - - -
void onColumnSplitterMoved(splitter, newSize)- - - - - - - - - - - -
Object render()- - - - - - - - - - - -
void renderRow(dataModel, row, rowIndex, colCount, renderers, dindexes)- - - - - - - - - - - -
void renderRows(dataModel)- - - - - - - - - - - -
void setCSSWidth(colIndex, width, pos)- - - - - - - - - - - -
void syncScroll()- - - - - - - - - - - -
void unhideColumn(colIndex)- - - - - - - - - - - -
void updateBodyHeight()- - - - - - - - - - - -
void updateCell(dataModel, rowIndex, dataIndex)- - - - - - - - - - - -
void updateColumns()- - - - - - - - - - - -
void updateHeaders()- - - - - - - - - - - -
void updateHeaderSortState()- - - - - - - - - - - -
void updateRowIndexes(firstRow, lastRow)- - - - - - - - - - - -
void updateRows(dataModel, firstRow, lastRow)- - - - - - - - - - - -
void updateWrapHeight()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.HeaderController -- - -
-
Used internal by GridView to route header related events.
-
Defined in GridView.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.HeaderController
-
- (grid)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- cancelTextSelection(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- headerClick(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- headerOut(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- headerOver(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- register(header)
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.grid.HeaderController(grid)- - - - - - - - - - - - - -
| - Method Detail - | -
void cancelTextSelection(e)- - - - - - - - - - - -
void headerClick(e)- - - - - - - - - - - -
void headerOut(e)- - - - - - - - - - - -
void headerOver(e)- - - - - - - - - - - -
void register(header)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.AbstractDataModel - | - +--YAHOO.ext.grid.DefaultDataModel - | - +--YAHOO.ext.grid.LoadableDataModel - | - +--YAHOO.ext.grid.JSONDataModel -- - -
-
This is an implementation of a DataModel used by the Grid. It works
- with JSON data.
-
Example schema:
-
- var schema = {
- root: 'Results.Result',
- id: 'ASIN',
- fields: ['Author', 'Title', 'Manufacturer', 'ProductGroup']
- };
-
- | Fields inherited from class YAHOO.ext.grid.LoadableDataModel | -
- onLoad, onLoadException, loadedPage, remoteSort, pageSize, pageUrl, baseParams, paramMap
- |
-
| Fields inherited from class YAHOO.ext.grid.AbstractDataModel | -
- onCellUpdated, onTableDataChanged, onRowsDeleted, onRowsInserted, onRowsUpdated, onRowsSorted, events, addListener, removeListener, fireEvent
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.JSONDataModel
-
- (schema)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Number
-
- |
-
-
-
- getRowId(<Number> rowIndex)
-
- - - Overrides getRowId in DefaultDataModel to return the ID value of the specified node. - |
-
-
- void
-
- |
-
-
-
- loadData(<Object> data, <Function> callback, keepExisting)
-
- - - Overrides loadData in LoadableDataModel to process JSON data - |
-
| Methods inherited from class YAHOO.ext.grid.LoadableDataModel | -
-
-isPaged, getTotalRowCount, getPageSize, getTotalPages, initPaging, loadPage, sort, load, fireLoadException, fireLoadEvent, addPreprocessor, getPreprocessor, removePreprocessor, addPostprocessor, getPostprocessor, removePostprocessor
- |
-
| Methods inherited from class YAHOO.ext.grid.DefaultDataModel | -
-
-getRowCount, getRow, getRows, getValueAt, setValueAt, removeRow, query, filter, addRow, insertRow, applySort, setDefaultSort
- |
-
| Methods inherited from class YAHOO.ext.grid.AbstractDataModel | -
-
-fireCellUpdated, fireTableDataChanged, fireRowsDeleted, fireRowsInserted, fireRowsUpdated, fireRowsSorted, getSortState
- |
-
| - Constructor Detail - | -
YAHOO.ext.grid.JSONDataModel(schema)- - - - - - - - - - - - - -
| - Method Detail - | -
Number getRowId(<Number> rowIndex)- -
rowIndex -
- void loadData(<Object> data, <Function> callback, keepExisting)- -
data - The JSON object to load
- callback -
- Object - | - +--YAHOO.ext.grid.AbstractDataModel - | - +--YAHOO.ext.grid.DefaultDataModel - | - +--YAHOO.ext.grid.LoadableDataModel -- -
-
This class extends DefaultDataModel and adds the core functionality to load data remotely.
-
Defined in LoadableDataModel.js
-
| Field Summary | |
- Object |
- baseParams
- - An object of key/value pairs to be passed as parameters - when loading pages/sorting |
-
- Number |
- loadedPage
- - The active page |
-
- YAHOO.util.CustomEvent |
- onLoad
- - Fires when a successful load is completed - fireDirect sig: (this) |
-
- YAHOO.util.CustomEvent |
- onLoadException
- - Fires when a load fails - fireDirect sig: (this, errorMsg, responseObj) |
-
- Number |
- pageSize
- - The number of records per page |
-
- String |
- pageUrl
- - The script/page to call to provide paged/sorted data |
-
- Object |
- paramMap
- - Maps named params to url parameters - Override to specify your own param names |
-
- Boolean |
- remoteSort
- - True to use remote sorting, initPaging automatically sets this to true |
-
- <static> Object |
- JSON
- - |
-
- <static> Object |
- TEXT
- - |
-
- <static> Object |
- XML
- - |
-
| Fields inherited from class YAHOO.ext.grid.AbstractDataModel | -
- onCellUpdated, onTableDataChanged, onRowsDeleted, onRowsInserted, onRowsUpdated, onRowsSorted, events, addListener, removeListener, fireEvent
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.LoadableDataModel
-
- (<String> dataType)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- addPostprocessor(columnIndex, fn)
-
- - - Adds a postprocessor function to format data before updating the underlying data source (ie. - |
-
-
- void
-
- |
-
-
-
- addPreprocessor(columnIndex, fn)
-
- - - Adds a preprocessor function to parse data before it is added to the Model - ie. - |
-
-
- void
-
- |
-
-
-
- fireLoadEvent()
-
- - - - |
-
-
- void
-
- |
-
-
-
- fireLoadException(e, responseObj)
-
- - - - |
-
-
- Number
-
- |
-
-
-
- getPageSize()
-
- - - Returns the number of records per page - |
-
-
- Object
-
- |
-
-
-
- getPostprocessor(columnIndex)
-
- - - Gets the postprocessor function for the specified column. - |
-
-
- Object
-
- |
-
-
-
- getPreprocessor(columnIndex)
-
- - - Gets the preprocessor function for the specified column. - |
-
-
- Number
-
- |
-
-
-
- getTotalPages()
-
- - - Returns the total number of pages available - |
-
-
- Number
-
- |
-
-
-
- getTotalRowCount()
-
- - - Returns the total number of records available, override if needed - |
-
-
- void
-
- |
-
-
-
- initPaging(url, pageSize, baseParams)
-
- - - Initializes paging for this model. - |
-
-
- Boolean
-
- |
-
-
-
- isPaged()
-
- - - Returns true if this model uses paging - |
-
-
- void
-
- |
-
-
-
- load(<Object/String> url, <String/Object> params, <Function> callback, <Number> insertIndex)
-
- - - Initiates the loading of the data from the specified URL - Failed load attempts will - fire the onLoadException event. - |
-
-
- void
-
- |
-
-
-
- loadData(data, callback, keepExisting, insertIndex)
-
- - - Empty interface method - Called to process the data returned by the XHR - Classes which extend LoadableDataModel should implement this method. - |
-
-
- void
-
- |
-
-
-
- loadPage(pageNum, callback, keepExisting)
-
- - - - |
-
-
- void
-
- |
-
-
-
- removePostprocessor(columnIndex)
-
- - - Removes a postprocessor function. - |
-
-
- void
-
- |
-
-
-
- removePreprocessor(columnIndex)
-
- - - Removes a preprocessor function. - |
-
-
- void
-
- |
-
-
-
- sort(columnModel, columnIndex, direction, suppressEvent)
-
- - - Overridden sort method to use remote sorting if turned on - |
-
| Methods inherited from class YAHOO.ext.grid.DefaultDataModel | -
-
-getRowCount, getRowId, getRow, getRows, getValueAt, setValueAt, removeRow, query, filter, addRow, insertRow, applySort, setDefaultSort
- |
-
| Methods inherited from class YAHOO.ext.grid.AbstractDataModel | -
-
-fireCellUpdated, fireTableDataChanged, fireRowsDeleted, fireRowsInserted, fireRowsUpdated, fireRowsSorted, getSortState
- |
-
| Field Detail | -
Object baseParams-
Number loadedPage-
YAHOO.util.CustomEvent onLoad-
YAHOO.util.CustomEvent onLoadException-
Number pageSize-
String pageUrl-
Object paramMap-
Boolean remoteSort-
<static> Object JSON-
<static> Object TEXT-
<static> Object XML-
| - Constructor Detail - | -
YAHOO.ext.grid.LoadableDataModel(<String> dataType)- - - - -
dataType - YAHOO.ext.grid.LoadableDataModel.XML, YAHOO.ext.grid.LoadableDataModel.TEXT or YAHOO.ext.grid.JSON
- | - Method Detail - | -
void addPostprocessor(columnIndex, fn)- -
void addPreprocessor(columnIndex, fn)- -
void fireLoadEvent()- - - - - - - - - - - -
void fireLoadException(e, responseObj)- - - - - - - - - - - -
Number getPageSize()- -
Object getPostprocessor(columnIndex)- -
Object getPreprocessor(columnIndex)- -
Number getTotalPages()- -
Number getTotalRowCount()- -
void initPaging(url, pageSize, baseParams)- -
Boolean isPaged()- -
void load(<Object/String> url, <String/Object> params, <Function> callback, <Number> insertIndex)- -
url - The url from which the data can be loaded
- params - (optional) The parameters to pass as either a url encoded string "param1=1¶m2=2" or as an object {param1: 1, param2: 2}
- callback - (optional) Callback when load is complete - called with signature (this, rowCountLoaded)
- insertIndex - (optional) if present, loaded data is inserted at the specified index instead of overwriting existing data
- void loadData(data, callback, keepExisting, insertIndex)- -
void loadPage(pageNum, callback, keepExisting)- - - - - - - - - - - -
void removePostprocessor(columnIndex)- -
void removePreprocessor(columnIndex)- -
void sort(columnModel, columnIndex, direction, suppressEvent)- -
Object - | - +--YAHOO.ext.grid.NumberEditor -- - -
- Defined in NumberEditor.js
-
| Field Summary | |
- Object |
- allowBlank
- - |
-
- Object |
- allowDecimals
- - |
-
- Object |
- allowNegative
- - |
-
- Object |
- blankText
- - |
-
- Object |
- decimalPrecision
- - |
-
- Object |
- decimalPrecisionFcn
- - |
-
- Object |
- decimalSeparator
- - |
-
- Object |
- maxText
- - |
-
- Object |
- maxValue
- - |
-
- Object |
- minText
- - |
-
- Object |
- minValue
- - |
-
- Object |
- nanText
- - |
-
- Object |
- selectOnFocus
- - |
-
- Object |
- validationDelay
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.NumberEditor
-
- (config)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- fixPrecision(value)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getValue()
-
- - - - |
-
-
- void
-
- |
-
-
-
- initEvents()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- parseValue(value)
-
- - - - |
-
-
- void
-
- |
-
-
-
- show()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- validate()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- validator()
-
- - - - |
-
| Field Detail | -
Object allowBlank-
Object allowDecimals-
Object allowNegative-
Object blankText-
Object decimalPrecision-
Object decimalPrecisionFcn-
Object decimalSeparator-
Object maxText-
Object maxValue-
Object minText-
Object minValue-
Object nanText-
Object selectOnFocus-
Object validationDelay-
| - Constructor Detail - | -
YAHOO.ext.grid.NumberEditor(config)- - - - - - - - - - - - - -
| - Method Detail - | -
Object fixPrecision(value)- - - - - - - - - - - -
Object getValue()- - - - - - - - - - - -
void initEvents()- - - - - - - - - - - -
Object parseValue(value)- - - - - - - - - - - -
void show()- - - - - - - - - - - -
Object validate()- - - - - - - - - - - -
Object validator()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.PagedGridView -- - -
- Defined in PagedGridView.js
-
| Field Summary | |
- Object |
- afterPageText
- - |
-
- Object |
- beforePageText
- - |
-
- Object |
- firstText
- - |
-
- Object |
- lastText
- - |
-
- Object |
- nextText
- - |
-
- Object |
- prevText
- - |
-
- Object |
- refreshText
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.PagedGridView
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- appendFooter(parentEl)
-
- - - - |
-
-
- void
-
- |
-
-
-
- beforeLoad()
-
- - - - |
-
-
- void
-
- |
-
-
-
- createPagingToolbar(container)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getPageToolbar()
-
- - - - |
-
-
- void
-
- |
-
-
-
- onClick(which)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onEnter(e)
-
- - - - |
-
-
- void
-
- |
-
-
-
- onPageLoaded(pageNum, totalPages)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- render()
-
- - - - |
-
| Field Detail | -
Object afterPageText-
Object beforePageText-
Object firstText-
Object lastText-
Object nextText-
Object prevText-
Object refreshText-
| - Constructor Detail - | -
YAHOO.ext.grid.PagedGridView()- - - - - - - - - - - - - -
| - Method Detail - | -
Object appendFooter(parentEl)- - - - - - - - - - - -
void beforeLoad()- - - - - - - - - - - -
void createPagingToolbar(container)- - - - - - - - - - - -
Object getPageToolbar()- - - - - - - - - - - -
void onClick(which)- - - - - - - - - - - -
void onEnter(e)- - - - - - - - - - - -
void onPageLoaded(pageNum, totalPages)- - - - - - - - - - - -
Object render()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.SelectEditor -- - -
- Defined in SelectEditor.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.SelectEditor
-
- (element)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- fitToCell(box)
-
- - - - |
-
| - Constructor Detail - | -
YAHOO.ext.grid.SelectEditor(element)- - - - - - - - - - - - - -
| - Method Detail - | -
void fitToCell(box)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.DefaultSelectionModel - | - +--YAHOO.ext.grid.SingleSelectionModel -- - -
-
Extends YAHOO.ext.grid.DefaultSelectionModel to allow only one row to be selected at a time.
-
Defined in SelectionModel.js
-
| Fields inherited from class YAHOO.ext.grid.DefaultSelectionModel | -
- onRowSelect, onSelectionChange, events, locked, addListener, removeListener, fireEvent
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.SingleSelectionModel
-
- ()
-
- - - - |
-|
| Methods inherited from class YAHOO.ext.grid.DefaultSelectionModel | -
-
-lock, unlock, isLocked, selectRowsById, getCount, selectFirstRow, selectNext, selectPrevious, getSelectedRows, getSelectedRowIds, clearSelections, selectAll, hasSelection, isSelected, isSelectable, focusRow, selectRow, selectRows, deselectRow, selectRange, deselectRange
- |
-
| - Constructor Detail - | -
YAHOO.ext.grid.SingleSelectionModel()- - - - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.TextEditor -- - -
- Defined in TextEditor.js
-
| Field Summary | |
- Object |
- allowBlank
- - |
-
- Object |
- blankText
- - |
-
- Object |
- maxLength
- - |
-
- Object |
- maxText
- - |
-
- Object |
- minLength
- - |
-
- Object |
- minText
- - |
-
- Object |
- regex
- - |
-
- Object |
- regexText
- - |
-
- Object |
- selectOnFocus
- - |
-
- Object |
- validationDelay
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.TextEditor
-
- (config)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- getValue()
-
- - - - |
-
-
- void
-
- |
-
-
-
- initEvents()
-
- - - - |
-
-
- void
-
- |
-
-
-
- show()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- validate()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- validator()
-
- - - - |
-
| Field Detail | -
Object allowBlank-
Object blankText-
Object maxLength-
Object maxText-
Object minLength-
Object minText-
Object regex-
Object regexText-
Object selectOnFocus-
Object validationDelay-
| - Constructor Detail - | -
YAHOO.ext.grid.TextEditor(config)- - - - - - - - - - - - - -
| - Method Detail - | -
Object getValue()- - - - - - - - - - - -
void initEvents()- - - - - - - - - - - -
void show()- - - - - - - - - - - -
Object validate()- - - - - - - - - - - -
Object validator()- - - - - - - - - - - -
Object - | - +--YAHOO.ext.grid.AbstractDataModel - | - +--YAHOO.ext.grid.DefaultDataModel - | - +--YAHOO.ext.grid.LoadableDataModel - | - +--YAHOO.ext.grid.XMLDataModel -- - -
-
This is an implementation of a DataModel used by the Grid. It works
- with XML data.
-
Example schema from Amazon search:
-
- var schema = {
- tagName: 'Item',
- id: 'ASIN',
- fields: ['Author', 'Title', 'Manufacturer', 'ProductGroup']
- };
-
- | Field Summary | |
- Object |
- xml
- - |
-
| Fields inherited from class YAHOO.ext.grid.LoadableDataModel | -
- onLoad, onLoadException, loadedPage, remoteSort, pageSize, pageUrl, baseParams, paramMap
- |
-
| Fields inherited from class YAHOO.ext.grid.AbstractDataModel | -
- onCellUpdated, onTableDataChanged, onRowsDeleted, onRowsInserted, onRowsUpdated, onRowsSorted, events, addListener, removeListener, fireEvent
- |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.grid.XMLDataModel
-
- (<Object> schema, <XMLDocument> xml)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Number
-
- |
-
-
-
- addRow(<String> id, <Array> cellValues)
-
- - - Adds a row to this DataModel and syncs the XML document - |
-
-
- XMLNode
-
- |
-
-
-
- createNode(<XMLDocument> xmlDoc, id, <Array> colData)
-
- - - Override this method to define your own node creation routine for when new rows are added. - |
-
-
- Object
-
- |
-
-
-
- getDocument()
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getNamedValue(node, name, defaultValue)
-
- - - Convenience function looks for value in attributes, then in children tags - also - normalizes namespace matches (ie matches ns:tag, FireFox matches tag and not ns:tag). - |
-
-
- Object
-
- |
-
-
-
- getNode(rowIndex)
-
- - - - |
-
-
- Number
-
- |
-
-
-
- getRowId(<Number> rowIndex)
-
- - - Overrides getRowId in DefaultDataModel to return the ID value of the specified node. - |
-
-
- Number
-
- |
-
-
-
- insertRow(<Number> index, <String> id, <Array> cellValues)
-
- - - Inserts a row into this DataModel and syncs the XML document - |
-
-
- void
-
- |
-
-
-
- loadData(<XMLDocument> doc, <Function> callback, <Boolean> keepExisting, <Number> insertIndex)
-
- - - Overrides loadData in LoadableDataModel to process XML - |
-
-
- void
-
- |
-
-
-
- removeRow(<Number> index)
-
- - - Removes the row from DataModel and syncs the XML document - |
-
-
- void
-
- |
-
-
-
- setNamedValue(node, name, value)
-
- - - Convenience function set a value in the underlying xml node. - |
-
-
- void
-
- |
-
-
-
- setValueAt(<Object> value, <Number> rowIndex, <Number> colIndex)
-
- - - Overrides DefaultDataModel.setValueAt to update the underlying XML Document - |
-
| Methods inherited from class YAHOO.ext.grid.LoadableDataModel | -
-
-isPaged, getTotalRowCount, getPageSize, getTotalPages, initPaging, loadPage, sort, load, fireLoadException, fireLoadEvent, addPreprocessor, getPreprocessor, removePreprocessor, addPostprocessor, getPostprocessor, removePostprocessor
- |
-
| Methods inherited from class YAHOO.ext.grid.DefaultDataModel | -
-
-getRowCount, getRow, getRows, getValueAt, query, filter, applySort, setDefaultSort
- |
-
| Methods inherited from class YAHOO.ext.grid.AbstractDataModel | -
-
-fireCellUpdated, fireTableDataChanged, fireRowsDeleted, fireRowsInserted, fireRowsUpdated, fireRowsSorted, getSortState
- |
-
| Field Detail | -
Object xml-
| - Constructor Detail - | -
YAHOO.ext.grid.XMLDataModel(<Object> schema, <XMLDocument> xml)- - - - -
schema - The schema to use
- xml - An XML document to load immediately
- | - Method Detail - | -
Number addRow(<String> id, <Array> cellValues)- -
id - The id of the row, if null the next row index is used
- cellValues - The cell values for this row
- XMLNode createNode(<XMLDocument> xmlDoc, id, <Array> colData)- -
xmlDoc - The xml document being used by this model
- colData - The column data for the new node
- Object getDocument()- - - - - - - - - - - -
Object getNamedValue(node, name, defaultValue)- -
Object getNode(rowIndex)- - - - - - - - - - - -
Number getRowId(<Number> rowIndex)- -
rowIndex -
- Number insertRow(<Number> index, <String> id, <Array> cellValues)- -
index - The index to insert the row
- id - The id of the row, if null the next row index is used
- cellValues - The cell values for this row
- void loadData(<XMLDocument> doc, <Function> callback, <Boolean> keepExisting, <Number> insertIndex)- -
doc - The document to load
- callback - (optional) callback to call when loading is complete
- keepExisting - (optional) true to keep existing data
- insertIndex - (optional) if present, loaded data is inserted at the specified index instead of overwriting existing data
- void removeRow(<Number> index)- -
index - The index of the row to remove
- void setNamedValue(node, name, value)- -
void setValueAt(<Object> value, <Number> rowIndex, <Number> colIndex)- -
value - The new value
- rowIndex -
- colIndex -
- Object - | - +--YAHOO.ext.grid -- - -
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- <static> void
-
- |
-
-
-
- EditorGrid(container, dataModel, colModel)
-
- - - - |
-
- - - - - - - - - - - - - - - - - -
| - Method Detail - | -
<static> void EditorGrid(container, dataModel, colModel)- - - - - - - - - - - -
Object - | - +--YAHOO.ext -- - -
| Nested Class Summary | -|
- <static class> |
- YAHOO.ext.Actor |
-
- <static class> |
- YAHOO.ext.Animator |
-
- <static class> |
- YAHOO.ext.DatePicker |
-
- <static class> |
- YAHOO.ext.SplitBar |
-
- <static class> |
- YAHOO.ext.TabPanel |
-
- <static class> |
- YAHOO.ext.TabPanelItem |
-
- <static class> |
- YAHOO.ext.Element |
-
- <static class> |
- YAHOO.ext.UpdateManager |
-
- <static class> |
- YAHOO.ext.Toolbar |
-
- <static class> |
- YAHOO.ext.ToolbarButton |
-
- <static class> |
- YAHOO.ext.Resizable |
-
| Field Summary | |
- <static> Object |
- Strict
- - |
-
| Field Detail | -
<static> Object Strict-
Object - | - +--YAHOO.ext.util.Bench -- - -
-
Very simple Benchmark class that supports multiple timers
-
Defined in yutil.js
-
| Field Summary | |
- Object |
- lastKey
- - |
-
- Object |
- timers
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.util.Bench
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- getElapsed(key)
-
- - - - |
-
-
- void
-
- |
-
-
-
- show()
-
- - - - |
-
-
- void
-
- |
-
-
-
- start(key)
-
- - - - |
-
-
- void
-
- |
-
-
-
- stop(key)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- toString(html)
-
- - - - |
-
| Field Detail | -
Object lastKey-
Object timers-
| - Constructor Detail - | -
YAHOO.ext.util.Bench()- - - - - - - - - - - - - -
| - Method Detail - | -
Object getElapsed(key)- - - - - - - - - - - -
void show()- - - - - - - - - - - -
void start(key)- - - - - - - - - - - -
void stop(key)- - - - - - - - - - - -
Object toString(html)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.util.Browser -- - -
| Field Summary | |
- Boolean |
- isGecko
- - |
-
- Boolean |
- isIE
- - |
-
- Boolean |
- isIE7
- - |
-
- Boolean |
- isOpera
- - |
-
- Boolean |
- isSafari
- - |
-
| Field Detail | -
Boolean isGecko-
Boolean isIE-
Boolean isIE7-
Boolean isOpera-
Boolean isSafari-
Object - | - +--YAHOO.ext.util.CSS -- - -
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- apply(el, <String/Array> selector)
-
- - - Applies a rule to an element without adding the class - |
-
-
- Object
-
- |
-
-
-
- applyFirst(el, id, selector)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- getRule(selector, refreshCache)
-
- - - Searches for a rule by selector - |
-
-
- Object
-
- |
-
-
-
- getRules(refreshCache)
-
- - - Gets all css rules for the document - |
-
-
- Object
-
- |
-
-
-
- revert(el, selector)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- revertFirst(el, id, selector)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- updateRule(<String/Array> selector, property, value)
-
- - - Updates a rule property - |
-
- - - - - - - - - - - - - - - - - -
| - Method Detail - | -
Object apply(el, <String/Array> selector)- -
selector - If it's an array it tries each selector until it finds one. Stops immediately once one is found.
- Object applyFirst(el, id, selector)- - - - - - - - - - - -
Object getRule(selector, refreshCache)- -
Object getRules(refreshCache)- -
Object revert(el, selector)- - - - - - - - - - - -
Object revertFirst(el, id, selector)- - - - - - - - - - - -
Object updateRule(<String/Array> selector, property, value)- -
selector - If it's an array it tries each selector until it finds one. Stops immediately once one is found.
- Object - | - +--YAHOO.ext.util.DelayedTask -- - -
-
Provides a convenient method of performing setTimeout where a new
- timeout cancels the old timeout. An example would be performing validation on a keypress.
- You can use this class to buffer
- the keypress events for a certain number of milliseconds, and perform only if they stop
- for that amount of time.
-
Defined in yutil.js
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.util.DelayedTask
-
- (<Function> fn, <Object> scope, <Array> args)
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- cancel()
-
- - - Cancel the last queued timeout - |
-
-
- void
-
- |
-
-
-
- delay(<Number> delay, <Function> newFn, <Object> newScope, <Array> newArgs)
-
- - - Cancels any pending timeout and queues a new one - |
-
| - Constructor Detail - | -
YAHOO.ext.util.DelayedTask(<Function> fn, <Object> scope, <Array> args)- - - - -
fn - (optional) The default function to timeout
- scope - (optional) The default scope of that timeout
- args - (optional) The default Array of arguments
- | - Method Detail - | -
void cancel()- -
void delay(<Number> delay, <Function> newFn, <Object> newScope, <Array> newArgs)- -
delay - The milliseconds to delay
- newFn - Overrides function passed to constructor
- newScope - Overrides scope passed to constructor
- newArgs - Overrides args passed to constructor
- Object - | - +--YAHOO.ext.util.Observable -- - -
- Defined in yutil.js
-
| Field Summary | |
- Object |
- on
- - |
-
| - Constructor Summary - | -|
-
-
- YAHOO.ext.util.Observable
-
- ()
-
- - - - |
-|
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- void
-
- |
-
-
-
- addListener(eventName, fn, scope, override)
-
- - - - |
-
-
- Object
-
- |
-
-
-
- delayedListener(eventName, fn, scope, delay)
-
- - - - |
-
-
- void
-
- |
-
-
-
- fireEvent()
-
- - - - |
-
-
- void
-
- |
-
-
-
- removeListener(eventName, fn, scope)
-
- - - - |
-
| Field Detail | -
Object on-
| - Constructor Detail - | -
YAHOO.ext.util.Observable()- - - - - - - - - - - - - -
| - Method Detail - | -
void addListener(eventName, fn, scope, override)- - - - - - - - - - - -
Object delayedListener(eventName, fn, scope, delay)- - - - - - - - - - - -
void fireEvent()- - - - - - - - - - - -
void removeListener(eventName, fn, scope)- - - - - - - - - - - -
Object - | - +--YAHOO.ext.util -- - -
| Nested Class Summary | -|
- <static class> |
- YAHOO.ext.util.Bench |
-
- <static class> |
- YAHOO.ext.util.DelayedTask |
-
- <static class> |
- YAHOO.ext.util.Observable |
-
| Field Summary | |
- <static> Object |
- Config
- - |
-
| Field Detail | -
<static> Object Config-
Object - | - +--YAHOO.util.CustomEvent -- - -
| - Method Summary - - * Parameter types in italic indicate optional parameters - - | -|
-
- Object
-
- |
-
-
-
- fireDirect()
-
- - - Enable custom handler signature and event cancelling. - |
-
- - - - - - - - - - - - - - - - - -
| - Method Detail - | -
Object fireDirect()- -
- if(beforeUpdateEvent.fireDirect(myArg, myArg2) !== false){
- // do update
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
-- - - | -||||||||
| - PREV - NEXT | -- FRAMES - NO FRAMES - - - - | -||||||||
- -- - --Each class has its own separate page. Each of these pages has three sections consisting of a class description, summary tables, and detailed member descriptions:
-
-Each summary entry contains the first sentence from the detailed description for that item.- Class inheritance diagram
- Direct Subclasses
- Class declaration
- Class description -
-
- Field Summary
- Constructor Summary
- Method Summary -
-
- Field Detail
- Constructor Detail
- Method Detail
-The Index contains an alphabetic list of all classes, constructors, methods, and fields.-
-
-
-This help file applies to API documentation generated using the standard doclet.
-
-
-
-
-
|
-- - - | -||||||||
| - PREV - NEXT | -- FRAMES - NO FRAMES - - - - | -||||||||
-
-
|
-- - - | -||||||||
| - PREV - NEXT | -- FRAMES - NO FRAMES - - - - | -||||||||
-
-
|
-- - - | -||||||||
| - PREV - NEXT | -- FRAMES - NO FRAMES - - - - | -||||||||
-This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
-
-Link to Non-frame version.
| All Classes
-
-
-Files
- |
-
- - - diff --git a/www/extras/yui-ext/docs/overview-summary-AbstractColumnModel.js.html b/www/extras/yui-ext/docs/overview-summary-AbstractColumnModel.js.html deleted file mode 100644 index 8fbf23799..000000000 --- a/www/extras/yui-ext/docs/overview-summary-AbstractColumnModel.js.html +++ /dev/null @@ -1,170 +0,0 @@ - - -
-- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.AbstractColumnModel | -This abstract class defines the ColumnModel interface and provides default implementations of the events required by the Grid. | -
/** - * @class - * This abstract class defines the ColumnModel interface and provides default implementations of the events required by the Grid. - * @constructor -*/ -YAHOO.ext.grid.AbstractColumnModel = function(){ - /** Fires when a column width is changed - fireDirect sig: (this, columnIndex, newWidth) - * @type YAHOO.util.CustomEvent - * */ - this.onWidthChange = new YAHOO.util.CustomEvent('widthChanged'); - /** Fires when a header has changed - fireDirect sig: (this, columnIndex, newHeader) - * @type YAHOO.util.CustomEvent - * */ - this.onHeaderChange = new YAHOO.util.CustomEvent('headerChanged'); - /** Fires when a column is hidden or unhidden - fireDirect sig: (this, columnIndex, hidden) - * @type YAHOO.util.CustomEvent - * */ - this.onHiddenChange = new YAHOO.util.CustomEvent('hiddenChanged'); -}; - -YAHOO.ext.grid.AbstractColumnModel.prototype = { - fireWidthChange : function(colIndex, newWidth){ - this.onWidthChange.fireDirect(this, colIndex, newWidth); - }, - - fireHeaderChange : function(colIndex, newHeader){ - this.onHeaderChange.fireDirect(this, colIndex, newHeader); - }, - - fireHiddenChange : function(colIndex, hidden){ - this.onHiddenChange.fireDirect(this, colIndex, hidden); - }, - - /** - * Interface method - Returns the number of columns. - * @return {Number} - */ - getColumnCount : function(){ - return 0; - }, - - /** - * Interface method - Returns true if the specified column is sortable. - * @param {Number} col The column index - * @return {Boolean} - */ - isSortable : function(col){ - return false; - }, - - /** - * Interface method - Returns true if the specified column is hidden. - * @param {Number} col The column index - * @return {Boolean} - */ - isHidden : function(col){ - return false; - }, - - /** - * Interface method - Returns the sorting comparison function defined for the column (defaults to sortTypes.none). - * @param {Number} col The column index - * @return {Function} - */ - getSortType : function(col){ - return YAHOO.ext.grid.DefaultColumnModel.sortTypes.none; - }, - - /** - * Interface method - Returns the rendering (formatting) function defined for the column. - * @param {Number} col The column index - * @return {Function} - */ - getRenderer : function(col){ - return YAHOO.ext.grid.DefaultColumnModel.defaultRenderer; - }, - - /** - * Interface method - Returns the width for the specified column. - * @param {Number} col The column index - * @return {Number} - */ - getColumnWidth : function(col){ - return 0; - }, - - /** - * Interface method - Returns the total width of all columns. - * @return {Number} - */ - getTotalWidth : function(){ - return 0; - }, - - /** - * Interface method - Returns the header for the specified column. - * @param {Number} col The column index - * @return {String} - */ - getColumnHeader : function(col){ - return ''; - } -}; --
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.AbstractDataModel | -This abstract class provides default implementations of the events required by the Grid. | -
/** - * @class - * This abstract class provides default implementations of the events required by the Grid. - It takes care of the creating the CustomEvents and provides some convenient methods for firing the events. <br><br> - * @constructor -*/ -YAHOO.ext.grid.AbstractDataModel = function(){ - /** Fires when a cell is updated - fireDirect sig: (this, rowIndex, columnIndex) - * @type YAHOO.util.CustomEvent - * @deprecated Use addListener instead of accessing directly - */ - this.onCellUpdated = new YAHOO.util.CustomEvent('onCellUpdated'); - /** Fires when all data needs to be revalidated - fireDirect sig: (thisd) - * @type YAHOO.util.CustomEvent - * @deprecated Use addListener instead of accessing directly - */ - this.onTableDataChanged = new YAHOO.util.CustomEvent('onTableDataChanged'); - /** Fires when rows are deleted - fireDirect sig: (this, firstRowIndex, lastRowIndex) - * @type YAHOO.util.CustomEvent - * @deprecated Use addListener instead of accessing directly - */ - this.onRowsDeleted = new YAHOO.util.CustomEvent('onRowsDeleted'); - /** Fires when a rows are inserted - fireDirect sig: (this, firstRowIndex, lastRowIndex) - * @type YAHOO.util.CustomEvent - * @deprecated Use addListener instead of accessing directly - */ - this.onRowsInserted = new YAHOO.util.CustomEvent('onRowsInserted'); - /** Fires when a rows are updated - fireDirect sig: (this, firstRowIndex, lastRowIndex) - * @type YAHOO.util.CustomEvent - * @deprecated Use addListener instead of accessing directly - */ - this.onRowsUpdated = new YAHOO.util.CustomEvent('onRowsUpdated'); - /** Fires when a sort has reordered the rows - fireDirect sig: (this, sortColumnIndex, - * sortDirection = 'ASC' or 'DESC') - * @type YAHOO.util.CustomEvent - * @deprecated Use addListener instead of accessing directly - */ - this.onRowsSorted = new YAHOO.util.CustomEvent('onRowsSorted'); - - this.events = { - 'cellupdated' : this.onCellUpdated, - 'datachanged' : this.onTableDataChanged, - 'rowsdeleted' : this.onRowsDeleted, - 'rowsinserted' : this.onRowsInserted, - 'rowsupdated' : this.onRowsUpdated, - 'rowssorted' : this.onRowsSorted - }; -}; - -YAHOO.ext.grid.AbstractDataModel.prototype = { - - addListener : YAHOO.ext.grid.Grid.prototype.addListener, - removeListener : YAHOO.ext.grid.Grid.prototype.removeListener, - fireEvent : YAHOO.ext.grid.Grid.prototype.fireEvent, - - /** - * Notifies listeners that the value of the cell at [row, col] has been updated - */ - fireCellUpdated : function(row, col){ - this.onCellUpdated.fireDirect(this, row, col); - }, - - /** - * Notifies listeners that all data for the grid may have changed - use as a last resort. This - * also wipes out all selections a user might have made. - */ - fireTableDataChanged : function(){ - this.onTableDataChanged.fireDirect(this); - }, - - /** - * Notifies listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted - */ - fireRowsDeleted : function(firstRow, lastRow){ - this.onRowsDeleted.fireDirect(this, firstRow, lastRow); - }, - - /** - * Notifies listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted - */ - fireRowsInserted : function(firstRow, lastRow){ - this.onRowsInserted.fireDirect(this, firstRow, lastRow); - }, - - /** - * Notifies listeners that rows in the range [firstRow, lastRow], inclusive, have been updated - */ - fireRowsUpdated : function(firstRow, lastRow){ - this.onRowsUpdated.fireDirect(this, firstRow, lastRow); - }, - - /** - * Notifies listeners that rows have been sorted and any indexes may be invalid - */ - fireRowsSorted : function(sortColumnIndex, sortDir, noRefresh){ - this.onRowsSorted.fireDirect(this, sortColumnIndex, sortDir, noRefresh); - }, - - /** - * Empty interface method - Classes which extend AbstractDataModel should implement this method. - * See {@link YAHOO.ext.DefaultDataModel} for an example implementation. - */ - sort : function(columnModel, columnIndex, direction, suppressEvent){ - - }, - - /** - * Interface method to supply the view with info regarding the Grid's current sort state - if overridden, - * this should return an object like this {column: this.sortColumn, direction: this.sortDir}. - * @return {Object} - */ - getSortState : function(){ - return {column: this.sortColumn, direction: this.sortDir}; - }, - - /** - * Empty interface method - Classes which extend AbstractDataModel should implement this method. - * See {@link YAHOO.ext.DefaultDataModel} for an example implementation. - */ - getRowCount : function(){ - - }, - - /** - * Empty interface method - Classes which extend AbstractDataModel should implement this method to support virtual row counts. - */ - getTotalRowCount : function(){ - return this.getRowCount(); - }, - - - /** - * Empty interface method - Classes which extend AbstractDataModel should implement this method. - * See {@link YAHOO.ext.DefaultDataModel} for an example implementation. - */ - getRowId : function(rowIndex){ - - }, - - /** - * Empty interface method - Classes which extend AbstractDataModel should implement this method. - * See {@link YAHOO.ext.DefaultDataModel} for an example implementation. - */ - getValueAt : function(rowIndex, colIndex){ - - }, - - /** - * Empty interface method - Classes which extend AbstractDataModel should implement this method. - * See {@link YAHOO.ext.DefaultDataModel} for an example implementation. - */ - setValueAt : function(value, rowIndex, colIndex){ - - }, - - isPaged : function(){ - return false; - } -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.Actor | -Provides support for syncing and chaining of Element Yahoo! | -
| YAHOO.ext.Actor.Action | -Used by YAHOO.ext.Actor to queue standard calls. | -
| YAHOO.ext.Actor.AsyncAction | -Used by YAHOO.ext.Actor to queue animations. | -
| YAHOO.ext.Actor.PauseAction | -Used by YAHOO.ext.Actor to perform pauses. | -
-/** - * @class - * Provides support for syncing and chaining of Element Yahoo! UI based animation and some common effects. Actors support "self-play" without an Animator.<br><br> - * <b>Note: Along with the animation methods defined below, this class inherits and captures all of the "set" or animation methods of {@link YAHOO.ext.Element}. "get" methods are not captured and execute immediately.</b> - * <br><br>Usage:<br> - * <pre><code> - * var actor = new YAHOO.ext.Actor('myElementId'); - * actor.startCapture(true); - * actor.moveTo(100, 100, true); - * actor.squish(); - * actor.play(); - * <br> - * // or to start capturing immediately, with no Animator (the null second param) - * <br> - * var actor = new YAHOO.ext.Actor('myElementId', null, true); - * actor.moveTo(100, 100, true); - * actor.squish(); - * actor.play(); - * </code></pre> - * @extends YAHOO.ext.Element - * @requires YAHOO.ext.Element - * @requires YAHOO.util.Dom - * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent - * @requires YAHOO.util.Anim - * @requires YAHOO.util.ColorAnim - * @requires YAHOO.util.Motion - * @className YAHOO.ext.Actor - * @constructor - * Create new Actor. - * @param {String/HTMLElement} el The dom element or element id - * @param {<i>YAHOO.ext.Animator</i>} animator (optional) The Animator that will capture this Actor's actions - * @param {<i>Boolean</i>} selfCapture (optional) Whether this actor should capture it's own actions to support self playback without an animator (defaults to false) - */ -YAHOO.ext.Actor = function(element, animator, selfCapture){ - YAHOO.ext.Actor.superclass.constructor.call(this, element, true); - - this.el = YAHOO.ext.Element.get(this.id); // cache el object for playback - - this.onCapture = new YAHOO.util.CustomEvent('Actor.onCapture'); - if(animator){ - /** - * The animator used to sync this actor with other actors - * @member YAHOO.ext.Actor - */ - animator.addActor(this); - } - /** - * Whether this actor is currently capturing - * @member YAHOO.ext.Actor - */ - this.capturing = selfCapture; - this.playlist = selfCapture ? new YAHOO.ext.Animator.AnimSequence() : null; -}; - -YAHOO.extendX(YAHOO.ext.Actor, YAHOO.ext.Element); - -/** - * Captures an action for this actor. Generally called internally but can be called directly. - # @param {YAHOO.ext.Actor.Action} action - */ -YAHOO.ext.Actor.prototype.capture = function(action){ - if(this.playlist != null){ - this.playlist.add(action); - } - this.onCapture.fireDirect(this, action); - return action; -}; - -/** @ignore */ -YAHOO.ext.Actor.overrideAnimation = function(method, animParam, onParam){ - return function(){ - if(!this.capturing){ - return method.apply(this, arguments); - } - var args = Array.prototype.slice.call(arguments, 0); - if(args[animParam] === true){ - return this.capture(new YAHOO.ext.Actor.AsyncAction(this, method, args, onParam)); - }else{ - return this.capture(new YAHOO.ext.Actor.Action(this, method, args)); - } - }; -} - -/** @ignore */ -YAHOO.ext.Actor.overrideBasic = function(method){ - return function(){ - if(!this.capturing){ - return method.apply(this, arguments); - } - var args = Array.prototype.slice.call(arguments, 0); - return this.capture(new YAHOO.ext.Actor.Action(this, method, args)); - }; -} - -// All of these methods below are marked "ignore" because JSDoc treats them as fields, not function. How brilliant. The Element methods are documented anyway though. -/** Capturing override - See {@link YAHOO.ext.Element#setVisibilityMode} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setVisibilityMode = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setVisibilityMode); -/** Capturing override - See {@link YAHOO.ext.Element#enableDisplayMode} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.enableDisplayMode = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.enableDisplayMode); -/** Capturing override - See {@link YAHOO.ext.Element#focus} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.focus = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.focus); -/** Capturing override - See {@link YAHOO.ext.Element#addClass} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.addClass = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.addClass); -/** Capturing override - See {@link YAHOO.ext.Element#removeClass} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.removeClass = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.removeClass); -/** Capturing override - See {@link YAHOO.ext.Element#replaceClass} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.replaceClass = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.replaceClass); -/** Capturing override - See {@link YAHOO.ext.Element#setStyle} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setStyle = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setStyle); -/** Capturing override - See {@link YAHOO.ext.Element#setX} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setX = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setX); -/** Capturing override - See {@link YAHOO.ext.Element#setY} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setY = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setY); -/** Capturing override - See {@link YAHOO.ext.Element#setLeft} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setLeft = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setLeft); -/** Capturing override - See {@link YAHOO.ext.Element#setTop} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setTop = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setTop); -/** Capturing override - See {@link YAHOO.ext.Element#setAbsolutePositioned} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setAbsolutePositioned = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setAbsolutePositioned); -/** Capturing override - See {@link YAHOO.ext.Element#setRelativePositioned} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setRelativePositioned = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setRelativePositioned); -/** Capturing override - See {@link YAHOO.ext.Element#clearPositioning} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.clearPositioning = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clearPositioning); -/** Capturing override - See {@link YAHOO.ext.Element#setPositioning} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setPositioning = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setPositioning); -/** Capturing override - See {@link YAHOO.ext.Element#clip} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.clip = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clip); -/** Capturing override - See {@link YAHOO.ext.Element#unclip} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.unclip = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.unclip); -/** Capturing override - See {@link YAHOO.ext.Element#clearOpacity} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.clearOpacity = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clearOpacity); -/** Capturing override - See {@link YAHOO.ext.Element#clearOpacity} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.update = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.update); - -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#animate} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.animate = function(args, duration, onComplete, easing, animType){ - if(!this.capturing){ - return YAHOO.ext.Actor.superclass.animate.apply(this, arguments); - } - return this.capture(new YAHOO.ext.Actor.AsyncAction(this, YAHOO.ext.Actor.superclass.animate, - [args, duration, onComplete, easing, animType], 2)); -}; - -/** Capturing and animation syncing override - See {@link YAHOO.ext.Element#setVisible} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setVisible = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setVisible, 1, 3); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#toggle} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.toggle = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.toggle, 0, 2); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setXY} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setXY = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setXY, 1, 3); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setLocation} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setLocation = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setLocation, 2, 4); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setWidth} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setWidth = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setWidth, 1, 3); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setHeight} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setHeight = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setHeight, 1, 3); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setSize} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setSize = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setSize, 2, 4); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setBounds} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setBounds = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setBounds, 4, 6); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setHeight} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.setOpacity = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setHeight, 1, 3); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#moveTo} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.moveTo = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.moveTo, 2, 4); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#move} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.move = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.move, 2, 4); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#alignTo} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.alignTo = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.alignTo, 3, 5); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#hide} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.hide = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.hide, 0, 2); -/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#show} for method details. - * @type Function */ -YAHOO.ext.Actor.prototype.show = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.show, 0, 2); - -/** - * Start self capturing calls on this Actor. All subsequent calls are captured and executed when play() is called. - */ -YAHOO.ext.Actor.prototype.startCapture = function(){ - this.capturing = true; - this.playlist = new YAHOO.ext.Animator.AnimSequence(); - }; - - /** - * Stop self capturing calls on this Actor. - */ - YAHOO.ext.Actor.prototype.stopCapture = function(){ - this.capturing = false; - }; - -/** - * Clears any calls that have been self captured. - */ -YAHOO.ext.Actor.prototype.clear = function(){ - this.playlist = new YAHOO.ext.Animator.AnimSequence(); -}; - -/** - * Starts playback of self captured calls. - * @param {<i>Function</i>} oncomplete (optional) Callback to execute when playback has completed - */ -YAHOO.ext.Actor.prototype.play = function(oncomplete){ - this.capturing = false; - if(this.playlist){ - this.playlist.play(oncomplete); - } - }; - -/** - * Capture a function call. - * @param {Function} fcn The function to call - * @param {<i>Array</i>} args (optional) The arguments to call the function with - * @param {<i>Object</i>} scope (optional) The scope of the function - */ -YAHOO.ext.Actor.prototype.addCall = function(fcn, args, scope){ - this.capture(new YAHOO.ext.Actor.Action(scope, fcn, args || [])); -}; - -/** - * Capture an async function call. - * @param {Function} fcn The function to call - * @param {Number} callbackIndex The index of the callback parameter on the passed function. A CALLBACK IS REQUIRED. - * @param {<i>Array</i>} args The arguments to call the function with - * @param {<i>Object</i>} scope (optional) The scope of the function - */ -YAHOO.ext.Actor.prototype.addAsyncCall = function(fcn, callbackIndex, args, scope){ - this.capture(new YAHOO.ext.Actor.AsyncAction(scope, fcn, args || [], callbackIndex)); - }, - -/** - * Capture a pause (in seconds). - * @param {Number} seconds The seconds to pause - */ -YAHOO.ext.Actor.prototype.pause = function(seconds){ - this.capture(new YAHOO.ext.Actor.PauseAction(seconds)); - }; - -/** -* Shake this element from side to side -*/ -YAHOO.ext.Actor.prototype.shake = function(){ - this.move('left', 20, true, .05); - this.move('right', 40, true, .05); - this.move('left', 40, true, .05); - this.move('right', 20, true, .05); -}; - -/** -* Bounce this element from up and down -*/ -YAHOO.ext.Actor.prototype.bounce = function(){ - this.move('up', 20, true, .05); - this.move('down', 40, true, .05); - this.move('up', 40, true, .05); - this.move('down', 20, true, .05); -}; - -/** -* Show the element using a "blinds" effect -* @param {String} anchor The part of the element that it should appear to exapand from. - The short/long options currently are t/top, l/left -* @param {<i>Number</i>} newSize (optional) The size to animate to. (Default to current size) -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -* @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut) -*/ -YAHOO.ext.Actor.prototype.blindShow = function(anchor, newSize, duration, easing){ - var size = newSize || this.getSize(); - this.clip(); - this.setVisible(true); - anchor = anchor.toLowerCase(); - switch(anchor){ - case 't': - case 'top': - this.setHeight(1); - this.setHeight(newSize, true, duration || .5, null, easing || YAHOO.util.Easing.easeOut); - break; - case 'l': - case 'left': - this.setWidth(1); - this.setWidth(newSize, true, duration || .5, null, easing || YAHOO.util.Easing.easeOut); - break; - } - this.unclip(); - return size; -}; - -/** -* Hide the element using a "blinds" effect -* @param {String} anchor The part of the element that it should appear to collapse to. - The short/long options are t/top, l/left, b/bottom, r/right. -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -* @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn) -*/ -YAHOO.ext.Actor.prototype.blindHide = function(anchor, duration, easing){ - var size = this.getSize(); - this.clip(); - anchor = anchor.toLowerCase(); - switch(anchor){ - case 't': - case 'top': - this.setSize(size.width, 1, true, duration || .5, null, easing || YAHOO.util.Easing.easeIn); - this.setVisible(false); - break; - case 'l': - case 'left': - this.setSize(1, size.height, true, duration || .5, null, easing || YAHOO.util.Easing.easeIn); - this.setVisible(false); - break; - case 'r': - case 'right': - this.animate({width: {to: 1}, points: {by: [this.getWidth(), 0]}}, - duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion); - this.setVisible(false); - break; - case 'b': - case 'bottom': - this.animate({height: {to: 1}, points: {by: [0, this.getHeight()]}}, - duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion); - this.setVisible(false); - break; - } - return size; -}; - -/** -* Show the element using a "slide in" effect - In order for this effect to work the element MUST have a child element container that can be "slid" otherwise a blindShow effect is rendered. -* @param {String} anchor The part of the element that it should appear to slide from. - The short/long options currently are t/top, l/left -* @param {<i>Number</i>} newSize (optional) The size to animate to. (Default to current size) -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -* @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOuth) -*/ -YAHOO.ext.Actor.prototype.slideShow = function(anchor, newSize, duration, easing){ - var size = newSize || this.getSize(); - this.clip(); - var firstChild = this.dom.firstChild; - if(!firstChild || (firstChild.nodeName && "#TEXT" == firstChild.nodeName.toUpperCase())) { // can't do a slide with only a textnode - this.blindShow(anchor, newSize, duration, easing); - return; - } - var child = YAHOO.ext.Element.get(firstChild, true); - var pos = child.getPositioning(); - this.addCall(child.setAbsolutePositioned, null, child); - this.setVisible(true); - anchor = anchor.toLowerCase(); - switch(anchor){ - case 't': - case 'top': - this.addCall(child.setStyle, ['left', '0px'], child); - this.addCall(child.setStyle, ['bottom', '0px'], child); - this.setHeight(1); - this.setHeight(newSize, true, duration || .5, null, easing || YAHOO.util.Easing.easeOut); - break; - case 'l': - case 'left': - this.addCall(child.setStyle, ['right', '0px'], child); - this.addCall(child.setStyle, ['top', '0px'], child); - this.setWidth(1); - this.setWidth(newSize, true, duration || .5, null, easing || YAHOO.util.Easing.easeOut); - break; - } - this.addCall(child.setPositioning, [pos], child); - this.unclip(); - return size; -}; - -/** -* Hide the element using a "slide in" effect - In order for this effect to work the element MUST have a child element container that can be "slid" otherwise a blindHide effect is rendered. -* @param {String} anchor The part of the element that it should appear to slide to. - The short/long options are t/top, l/left, b/bottom, r/right. -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -* @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn) -*/ -YAHOO.ext.Actor.prototype.slideHide = function(anchor, duration, easing){ - var size = this.getSize(); - this.clip(); - var firstChild = this.dom.firstChild; - if(!firstChild || (firstChild.nodeName && "#TEXT" == firstChild.nodeName.toUpperCase())) { // can't do a slide with only a textnode - this.blindHide(anchor, duration, easing); - return; - } - var child = YAHOO.ext.Element.get(firstChild, true); - var pos = child.getPositioning(); - this.addCall(child.setAbsolutePositioned, null, child); - anchor = anchor.toLowerCase(); - switch(anchor){ - case 't': - case 'top': - this.addCall(child.setStyle, ['left', '0px'], child); - this.addCall(child.setStyle, ['bottom', '0px'], child); - this.setSize(size.width, 1, true, duration || .5, null, easing || YAHOO.util.Easing.easeIn); - this.setVisible(false); - break; - case 'l': - case 'left': - this.addCall(child.setStyle, ['right', '0px'], child); - this.addCall(child.setStyle, ['top', '0px'], child); - this.setSize(1, size.height, true, duration || .5, null, easing || YAHOO.util.Easing.easeIn); - this.setVisible(false); - break; - case 'r': - case 'right': - this.addCall(child.setStyle, ['left', '0px'], child); - this.addCall(child.setStyle, ['top', '0px'], child); - this.animate({width: {to: 1}, points: {by: [this.getWidth(), 0]}}, - duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion); - this.setVisible(false); - break; - case 'b': - case 'bottom': - this.addCall(child.setStyle, ['left', '0px'], child); - this.addCall(child.setStyle, ['bottom', '0px'], child); - this.animate({height: {to: 1}, points: {by: [0, this.getHeight()]}}, - duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion); - this.setVisible(false); - break; - } - this.addCall(child.setPositioning, [pos], child); - return size; -}; - -/** -* Hide the element by "squishing" it into the corner -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -*/ -YAHOO.ext.Actor.prototype.squish = function(duration){ - var size = this.getSize(); - this.clip(); - this.setSize(1, 1, true, duration || .5); - this.setVisible(false); - return size; -}; - -/** -* Fade an element in -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -*/ -YAHOO.ext.Actor.prototype.appear = function(duration){ - this.setVisible(true, true, duration); -}; - -/** -* Fade an element out -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -*/ -YAHOO.ext.Actor.prototype.fade = function(duration){ - this.setVisible(false, true, duration); -}; - -/** -* Blink the element as if it was clicked and then collapse on it's center -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -*/ -YAHOO.ext.Actor.prototype.switchOff = function(duration){ - this.clip(); - this.setVisible(false, true, .1); - this.clearOpacity(); - this.setVisible(true); - this.animate({height: {to: 1}, points: {by: [0, this.getHeight()/2]}}, - duration || .5, null, YAHOO.util.Easing.easeOut, YAHOO.util.Motion); - this.setVisible(false); -}; - -/** -* Highlight the element using a background color (or passed attribute) animation -* @param {String} color (optional) The color to use for the highlight -* @param {<i>String</i>} fromColor (optional) If the element does not currently have a background color, you will need to pass in a color to animate from -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -* @param {<i>String</i>} attribute (optional) Specify a CSS attribute to use other than background color - camelCase -*/ -YAHOO.ext.Actor.prototype.highlight = function(color, fromColor, duration, attribute){ - attribute = attribute || 'backgroundColor'; - var original = this.getStyle(attribute); - fromColor = fromColor || ((original && original != '' && original != 'transparent') ? original : '#FFFFFF'); - var cfg = {}; - cfg[attribute] = {to: color, from: fromColor}; - this.setVisible(true); - this.animate(cfg, duration || .5, null, YAHOO.util.Easing.bounceOut, YAHOO.util.ColorAnim); - this.setStyle(attribute, original); -}; - -/** -* Fade the element in and out the specified amount of times -* @param {<i>Number</i>} count (optional) How many times to pulse (Defaults to 3) -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -*/ -YAHOO.ext.Actor.prototype.pulsate = function(count, duration){ - count = count || 3; - for(var i = 0; i < count; i++){ - this.toggle(true, duration || .25); - this.toggle(true, duration || .25); - } -}; - -/** -* Fade the element as it is falling from it's current position -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -*/ -YAHOO.ext.Actor.prototype.dropOut = function(duration){ - this.animate({opacity: {to: 0}, points: {by: [0, this.getHeight()]}}, - duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion); - this.setVisible(false); -}; - -/** -* Hide the element in a way that it appears as if it is flying off the screen -* @param {String} anchor The part of the page that the element should appear to move to. - The short/long options are t/top, l/left, b/bottom, r/right, tl/top-left, - tr/top-right, bl/bottom-left or br/bottom-right. -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -* @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn) -*/ -YAHOO.ext.Actor.prototype.moveOut = function(anchor, duration, easing){ - var Y = YAHOO.util; - var vw = Y.Dom.getViewportWidth(); - var vh = Y.Dom.getViewportHeight(); - var cpoints = this.getCenterXY() - var centerX = cpoints[0]; - var centerY = cpoints[1]; - var anchor = anchor.toLowerCase(); - var p; - switch(anchor){ - case 't': - case 'top': - p = [centerX, -this.getHeight()]; - break; - case 'l': - case 'left': - p = [-this.getWidth(), centerY]; - break; - case 'r': - case 'right': - p = [vw+this.getWidth(), centerY]; - break; - case 'b': - case 'bottom': - p = [centerX, vh+this.getHeight()]; - break; - case 'tl': - case 'top-left': - p = [-this.getWidth(), -this.getHeight()]; - break; - case 'bl': - case 'bottom': - p = [-this.getWidth(), vh+this.getHeight()]; - break; - case 'br': - case 'bottom-right': - p = [vw+this.getWidth(), vh+this.getHeight()]; - break; - case 'tr': - case 'top-right': - p = [vw+this.getWidth(), -this.getHeight()]; - break; - } - this.moveTo(p[0], p[1], true, duration || .35, null, easing || Y.Easing.easeIn); - this.setVisible(false); -}; - -/** -* Show the element in a way that it appears as if it is flying onto the screen -* @param {String} anchor The part of the page that the element should appear to move from. - The short/long options are t/top, l/left, b/bottom, r/right, tl/top-left, - tr/top-right, bl/bottom-left or br/bottom-right. -* @param {<i>Array</i>} to (optional) Array of x and y position to move to like [x, y] (Defaults to center screen) -* @param {<i>Float</i>} duration (optional) How long the effect lasts (in seconds) -* @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut) -*/ -YAHOO.ext.Actor.prototype.moveIn = function(anchor, to, duration, easing){ - to = to || this.getCenterXY(); - this.moveOut(anchor, .01); - this.setVisible(true); - this.setXY(to, true, duration || .35, null, easing || YAHOO.util.Easing.easeOut); -}; - - - -/** - * @class Used by {@link YAHOO.ext.Actor} to queue standard calls. Generally used internally. Documentation to come.<br><br> - */ -YAHOO.ext.Actor.Action = function(actor, method, args){ - this.actor = actor; - this.method = method; - this.args = args; - //alert('queueing ' + actor.id + ' ' + method.toString()); - } - -YAHOO.ext.Actor.Action.prototype = { - play : function(onComplete){ - this.method.apply(this.actor || window, this.args); - onComplete(); - } -}; - - -/** - * @class Used by {@link YAHOO.ext.Actor} to queue animations. Generally used internally. Documentation to come.<br><br> - */ -YAHOO.ext.Actor.AsyncAction = function(actor, method, args, onIndex){ - YAHOO.ext.Actor.AsyncAction.superclass.constructor.call(this, actor, method, args); - this.onIndex = onIndex; - this.originalCallback = this.args[onIndex]; -} -YAHOO.extendX(YAHOO.ext.Actor.AsyncAction, YAHOO.ext.Actor.Action); - -YAHOO.ext.Actor.AsyncAction.prototype.play = function(onComplete){ - var callbackArg = this.originalCallback ? - this.originalCallback.createSequence(onComplete) : onComplete; - this.args[this.onIndex] = callbackArg; - this.method.apply(this.actor, this.args); -}; - - -/** - * @class Used by {@link YAHOO.ext.Actor} to perform pauses. Generally used internally. Documentation to come.<br><br> - */ -YAHOO.ext.Actor.PauseAction = function(seconds){ - this.seconds = seconds; -}; -YAHOO.ext.Actor.PauseAction.prototype = { - play : function(onComplete){ - setTimeout(onComplete, this.seconds * 1000); - } -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.Animator | -Provides support for syncing animations for multiple YAHOO.ext.Actors. - This example can be seen in action here by clicking on "Click here and I will point it out". - |
-
| YAHOO.ext.Animator.AnimSequence | -Used by YAHOO.ext.Animator to sequence animations. | -
| YAHOO.ext.Animator.CompositeSequence | -Used by YAHOO.ext.Animator to run multiple animation sequences at once. | -
/** - * @class - * Provides support for syncing animations for multiple {@link YAHOO.ext.Actor}s.<br><br> -* <br><br>This example can be seen in action <a href="http://jackslocum.blogspot.com/2006/08/splitbar-component-for-yahoo-ui.html" target="_new">here</a> by clicking on "Click here and I will point it out".<br> - * <pre><code> -var animator = new YAHOO.ext.Animator(); -var cursor = new YAHOO.ext.Actor('cursor-img', animator); -var click = new YAHOO.ext.Actor('click-img', animator); -var resize = new YAHOO.ext.Actor('resize-img', animator); - -// start capturing -animator.startCapture(); - -// these animations will be run in sequence -cursor.show(); -cursor.moveTo(500,400); -cursor.moveTo(20, getEl('navbar').getY()+10, true, .75); -click.show(); -click.alignTo(cursor, 'tl', [-4, -4]); - -// Add an async function call, pass callback to argument 1 -animator.addAsyncCall(Blog.navbar.undockDelegate, 1); - -// pause .5 seconds -animator.pause(.5); - -// again, these animations will be run in sequence -click.hide(true, .7); -cursor.alignTo('splitter', 'tr', [0, +100], true, 1); -resize.alignTo('splitter', 'tr', [-12, +100]); - -// start sync block: these animations will run at the same time -animator.beginSync(); -cursor.hide(); -resize.show(); -animator.endSync(); - -// play the captured animation sequences, call myCallback when done -animator.play(myCallback); - * </code></pre> - * @extends YAHOO.ext.Element - * @requires YAHOO.ext.Element - * @requires YAHOO.util.Dom - * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent - * @requires YAHOO.util.Anim - * @requires YAHOO.util.ColorAnim - * @requires YAHOO.util.Motion - * @constructor - * @param {String/HTMLElement} el The dom element or element id - * @param {<i>YAHOO.ext.Animator</i>} animator (optional) The Animator that will capture this Actor's actions - * @param {<i>Boolean</i>} selfCapture (optional) Whether this actor should capture it's own actions to support self playback without an animator (defaults to false) - */ - YAHOO.ext.Animator = function(/*Actors...*/){ - /** @private */ - this.actors = []; - /** @private */ - this.playlist = new YAHOO.ext.Animator.AnimSequence(); - /** @private */ - this.captureDelegate = this.capture.createDelegate(this); - /** @private */ - this.playDelegate = this.play.createDelegate(this); - /** @private */ - this.syncing = false; - /** @private */ - this.stopping = false; - /** @private */ - this.playing = false; - for(var i = 0; i < arguments.length; i++){ - this.addActor(arguments[i]); - } - }; - - YAHOO.ext.Animator.prototype = { - - /** - * @private - */ - capture : function(actor, action){ - if(this.syncing){ - if(!this.syncMap[actor.id]){ - this.syncMap[actor.id] = new YAHOO.ext.Animator.AnimSequence(); - } - this.syncMap[actor.id].add(action); - }else{ - this.playlist.add(action); - } - }, - - /** - * Add an actor. The actor is also set to capturing = true. - * @param {YAHOO.ext.Actor} actor - */ - addActor : function(actor){ - actor.onCapture.subscribe(this.captureDelegate); - this.actors.push(actor); - }, - - - /** - * Start capturing actions on the added actors. - * @param {<i>Boolean</i>} clearPlaylist Whether to also create a new playlist - */ - startCapture : function(clearPlaylist){ - for(var i = 0; i < this.actors.length; i++){ - var a = this.actors[i]; - if(!this.isCapturing(a)){ - a.onCapture.subscribe(this.captureDelegate); - } - a.capturing = true; - } - if(clearPlaylist){ - this.playlist = new YAHOO.ext.Animator.AnimSequence(); - } - }, - - /** - * Checks whether this animator is listening to a specific actor. - * @param {YAHOO.ext.Actor} actor - */ - isCapturing : function(actor){ - var subscribers = actor.onCapture.subscribers; - if(subscribers){ - for(var i = 0; i < subscribers.length; i++){ - if(subscribers[i] && subscribers[i].contains(this.captureDelegate)){ - return true; - } - } - } - return false; - }, - - /** - * Stop capturing on all added actors. - */ - stopCapture : function(){ - for(var i = 0; i < this.actors.length; i++){ - var a = this.actors[i]; - a.onCapture.unsubscribe(this.captureDelegate); - a.capturing = false; - } - }, - - /** - * Start a multi-actor sync block. By default all animations are run in sequence. While in the sync block - * each actor's own animations will still be sequenced, but all actors will animate at the same time. - */ - beginSync : function(){ - this.syncing = true; - this.syncMap = {}; - }, - - /** - * End the multi-actor sync block - */ - endSync : function(){ - this.syncing = false; - var composite = new YAHOO.ext.Animator.CompositeSequence(); - for(key in this.syncMap){ - if(typeof this.syncMap[key] != 'function'){ - composite.add(this.syncMap[key]); - } - } - this.playlist.add(composite); - this.syncMap = null; - }, - - /** - * Starts playback of the playlist, also stops any capturing. To start capturing again call {@link #startCapture}. - * @param {<i>Function</i>} oncomplete (optional) Callback to execute when playback has completed - */ - play : function(oncomplete){ - if(this.playing) return; // can't play the same animation twice at once - this.stopCapture(); - this.playlist.play(oncomplete); - }, - - /** - * Stop at the next available stopping point - */ - stop : function(){ - this.playlist.stop(); - }, - - /** - * Check if this animator is currently playing - */ - isPlaying : function(){ - return this.playlist.isPlaying(); - }, - /** - * Clear the playlist - */ - clear : function(){ - this.playlist = new YAHOO.ext.Animator.AnimSequence(); - }, - - /** - * Add a function call to the playlist. - * @param {Function} fcn The function to call - * @param {<i>Array</i>} args The arguments to call the function with - * @param {<i>Object</i>} scope (optional) The scope of the function - */ - addCall : function(fcn, args, scope){ - this.playlist.add(new YAHOO.ext.Actor.Action(scope, fcn, args || [])); - }, - - /** - * Add an async function call to the playlist. - * @param {Function} fcn The function to call - * @param {Number} callbackIndex The index of the callback parameter on the passed function. A CALLBACK IS REQUIRED. - * @param {<i>Array</i>} args The arguments to call the function with - * @param {<i>Object</i>} scope (optional) The scope of the function - */ - addAsyncCall : function(fcn, callbackIndex, args, scope){ - this.playlist.add(new YAHOO.ext.Actor.AsyncAction(scope, fcn, args || [], callbackIndex)); - }, - - /** - * Add a pause to the playlist (in seconds) - * @param {Number} seconds The number of seconds to pause. - */ - pause : function(seconds){ - this.playlist.add(new YAHOO.ext.Actor.PauseAction(seconds)); - } - - }; - - -/** - * @class Used by {@link YAHOO.ext.Animator} to sequence animations. Generally used internally. Documentation to come.<br><br> - */ -YAHOO.ext.Animator.AnimSequence = function(){ - this.actions = []; - this.nextDelegate = this.next.createDelegate(this); - this.playDelegate = this.play.createDelegate(this); - this.oncomplete = null; - this.playing = false; - this.stopping = false; - this.actionIndex = -1; - }; - - YAHOO.ext.Animator.AnimSequence.prototype = { - - add : function(action){ - this.actions.push(action); - }, - - next : function(){ - if(this.stopping){ - this.playing = false; - if(this.oncomplete){ - this.oncomplete(this, false); - } - return; - } - var nextAction = this.actions[++this.actionIndex]; - if(nextAction){ - nextAction.play(this.nextDelegate); - }else{ - this.playing = false; - if(this.oncomplete){ - this.oncomplete(this, true); - } - } - }, - - play : function(oncomplete){ - if(this.playing) return; // can't play the same sequence twice at once - this.oncomplete = oncomplete; - this.stopping = false; - this.playing = true; - this.actionIndex = -1; - this.next(); - }, - - stop : function(){ - this.stopping = true; - }, - - isPlaying : function(){ - return this.playing; - }, - - clear : function(){ - this.actions = []; - }, - - addCall : function(fcn, args, scope){ - this.actions.push(new YAHOO.ext.Actor.Action(scope, fcn, args || [])); - }, - - /** - * Add an async function call to the capture queue. - * @param {Function} fcn The function to call - * @param {Number} callbackIndex The index of the callback parameter on the passed function. A CALLBACK IS REQUIRED. - * @param {<i>Array</i>} args The arguments to call the function with - * @param {<i>Object</i>} scope (optional) The scope of the function - */ - addAsyncCall : function(fcn, callbackIndex, args, scope){ - this.actions.push(new YAHOO.ext.Actor.AsyncAction(scope, fcn, args || [], callbackIndex)); - }, - - pause : function(seconds){ - this.actions.push(new YAHOO.ext.Actor.PauseAction(seconds)); - } - - }; - -/** - * @class Used by {@link YAHOO.ext.Animator} to run multiple animation sequences at once. Generally used internally. Documentation to come.<br><br> - */ -YAHOO.ext.Animator.CompositeSequence = function(){ - this.sequences = []; - this.completed = 0; - this.trackDelegate = this.trackCompletion.createDelegate(this); -} - -YAHOO.ext.Animator.CompositeSequence.prototype = { - add : function(sequence){ - this.sequences.push(sequence); - }, - - play : function(onComplete){ - this.completed = 0; - if(this.sequences.length < 1){ - if(onComplete)onComplete(); - return; - } - this.onComplete = onComplete; - for(var i = 0; i < this.sequences.length; i++){ - this.sequences[i].play(this.trackDelegate); - } - }, - - trackCompletion : function(){ - ++this.completed; - if(this.completed >= this.sequences.length && this.onComplete){ - this.onComplete(); - } - }, - - stop : function(){ - for(var i = 0; i < this.sequences.length; i++){ - this.sequences[i].stop(); - } - }, - - isPlaying : function(){ - for(var i = 0; i < this.sequences.length; i++){ - if(this.sequences[i].isPlaying()){ - return true; - } - } - return false; - } -}; - - --
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.CellEditor | -- |
YAHOO.ext.grid.CellEditor = function(element){ - this.colIndex = null; - this.rowIndex = null; - this.grid = null; - this.editing = false; - this.originalValue = null; - this.element = getEl(element, true); - this.element.addClass('ygrid-editor'); - this.element.dom.tabIndex = 1; - this.initialized = false; - this.callback = null; -}; - -YAHOO.ext.grid.CellEditor.prototype = { - init : function(grid, bodyElement, callback){ - // there's no way for the grid to know if multiple columns - // share the same editor so it will try to initialize the - // same one over and over - if(this.initialized) return; - this.initialized = true; - this.callback = callback; - this.grid = grid; - bodyElement.appendChild(this.element.dom); - this.initEvents(); - }, - - initEvents : function(){ - var stopOnEnter = function(e){ - if(e.browserEvent.keyCode == e.RETURN){ - this.stopEditing(true); - } - } - this.element.mon('keydown', stopOnEnter, this, true); - this.element.on('blur', this.stopEditing, this, true); - }, - - startEditing : function(value, row, cell){ - this.originalValue = value; - this.rowIndex = row.rowIndex; - this.colIndex = cell.columnIndex; - this.cell = cell; - this.setValue(value); - var cellbox = getEl(cell, true).getBox(); - this.fitToCell(cellbox); - this.editing = true; - this.show(); - }, - - stopEditing : function(focusCell){ - if(this.editing){ - this.editing = false; - var newValue = this.getValue(); - this.hide(); - //if(focusCell){try{this.cell.focus();}catch(e){}}; // try to give the cell focus so keyboard nav still works - if(this.originalValue != newValue){ - this.callback(newValue, this.rowIndex, this.colIndex); - } - } - }, - - setValue : function(value){ - this.element.dom.value = value; - }, - - getValue : function(){ - return this.element.dom.value; - }, - - fitToCell : function(box){ - this.element.setBox(box, true); - }, - - show : function(){ - this.element.show(); - this.element.focus(); - }, - - hide : function(){ - try{ - this.element.dom.blur(); - }catch(e){} - this.element.hide(); - } -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.CheckboxEditor | -- |
-YAHOO.ext.grid.CheckboxEditor = function(){ - var div = document.createElement('span'); - div.className = 'ygrid-editor ygrid-checkbox-editor'; - var cb = document.createElement('input'); - cb.type = 'checkbox'; - cb.setAttribute('autocomplete', 'off'); - div.appendChild(cb); - document.body.appendChild(div); - YAHOO.ext.grid.CheckboxEditor.superclass.constructor.call(this, div); - div.tabIndex = ''; - cb.tabIndex = 1; - this.cb = getEl(cb, true); -}; - -YAHOO.extendX(YAHOO.ext.grid.CheckboxEditor, YAHOO.ext.grid.CellEditor); - -YAHOO.ext.grid.CheckboxEditor.prototype.fitToCell = function(box){ - this.element.setBox(box, true); -}; - -YAHOO.ext.grid.CheckboxEditor.prototype.setValue = function(value){ - this.cb.dom.checked = (value === true || value === 'true' || value === 1 || value === '1'); -}; - -YAHOO.ext.grid.CheckboxEditor.prototype.getValue = function(){ - return this.cb.dom.checked; -}; - -YAHOO.ext.grid.CheckboxEditor.prototype.show = function(){ - this.element.show(); - this.cb.focus(); -}; - -YAHOO.ext.grid.CheckboxEditor.prototype.initEvents = function(){ - var stopOnEnter = function(e){ - if(e.browserEvent.keyCode == e.RETURN){ - this.stopEditing(true); - } - } - this.cb.mon('keydown', stopOnEnter, this, true); - this.cb.on('blur', this.stopEditing, this, true); -}; - -YAHOO.ext.grid.CheckboxEditor.prototype.hide = function(){ - try{ - this.cb.dom.blur(); - }catch(e){} - this.element.hide(); -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.DateEditor | -- |
YAHOO.ext.grid.DateEditor = function(config){ - var div = document.createElement('span'); - div.className = 'ygrid-editor ygrid-editor-container'; - - var element = document.createElement('input'); - element.type = 'text'; - element.tabIndex = 1; - element.setAttribute('autocomplete', 'off'); - div.appendChild(element); - - var pick = document.createElement('span'); - pick.className = 'pick-button'; - div.appendChild(pick); - - document.body.appendChild(div); - - this.div = getEl(div, true); - this.element = getEl(element, true); - this.pick = getEl(pick, true); - - this.colIndex = null; - this.rowIndex = null; - this.grid = null; - this.editing = false; - this.originalValue = null; - this.initialized = false; - this.callback = null; - - this.cal = null; - this.mouseDownHandler = YAHOO.ext.EventManager.wrap(this.handleMouseDown, this, true); - - YAHOO.ext.util.Config.apply(this, config); - if(typeof this.minValue == 'string') this.minValue = this.parseDate(this.minValue); - if(typeof this.maxValue == 'string') this.maxValue = this.parseDate(this.maxValue); - this.ddMatch = /ddnone/; - if(this.disabledDates){ - var dd = this.disabledDates; - var re = "(?:"; - for(var i = 0; i < dd.length; i++){ - re += dd[i]; - if(i != dd.length-1) re += "|"; - } - this.ddMatch = new RegExp(re + ")"); - } -}; - -YAHOO.ext.grid.DateEditor.prototype = { - init : function(grid, bodyElement, callback){ - if(this.initialized) return; - - this.initialized = true; - this.callback = callback; - this.grid = grid; - bodyElement.appendChild(this.div.dom); - this.initEvents(); - }, - - initEvents : function(){ - var stopOnEnter = function(e){ - if(e.browserEvent.keyCode == e.RETURN){ - this.stopEditing(true); - } - } - this.element.mon('keydown', stopOnEnter, this, true); - var vtask = new YAHOO.ext.util.DelayedTask(this.validate, this); - this.element.mon('keyup', vtask.delay.createDelegate(vtask, [this.validationDelay])); - this.pick.on('click', this.showCalendar, this, true); - }, - - startEditing : function(value, row, cell){ - this.originalValue = value; - this.rowIndex = row.rowIndex; - this.colIndex = cell.columnIndex; - this.cell = cell; - this.setValue(value); - this.validate(); - var cellbox = getEl(cell, true).getBox(); - this.div.setBox(cellbox, true); - this.element.setWidth(cellbox.width-this.pick.getWidth()); - this.editing = true; - YAHOO.util.Event.on(document, "mousedown", this.mouseDownHandler); - this.show(); - }, - - stopEditing : function(focusCell){ - if(this.editing){ - YAHOO.util.Event.removeListener(document, "mousedown", this.mouseDownHandler); - this.editing = false; - var newValue = this.getValue(); - this.hide(); - //if(focusCell){try{this.cell.focus();}catch(e){}}// try to give the cell focus so keyboard nav still works - if(this.originalValue != newValue){ - this.callback(newValue, this.rowIndex, this.colIndex); - } - } - }, - - setValue : function(value){ - this.element.dom.value = this.formatDate(value); - this.validate(); - }, - - getValue : function(){ - if(!this.validate()){ - return this.originalValue; - }else{ - var value = this.element.dom.value; - if(value.length < 1){ - return value; - } else{ - return this.parseDate(value); - } - } - }, - - show : function() { - this.div.show(); - this.element.focus(); - this.validate(); - }, - - hide : function(){ - try{ - this.element.dom.blur(); - }catch(e){} - this.div.hide(); - }, - - validate : function(){ - var dom = this.element.dom; - var value = dom.value; - if(value.length < 1){ // if it's blank - if(this.allowBlank){ - dom.title = ''; - this.element.removeClass('ygrid-editor-invalid'); - return true; - }else{ - dom.title = this.blankText; - this.element.addClass('ygrid-editor-invalid'); - return false; - } - } - value = this.parseDate(value); - if(!value){ - dom.title = this.invalidText.replace('%0', dom.value).replace('%1', this.format); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - var time = value.getTime(); - if(this.minValue && time < this.minValue.getTime()){ - dom.title = this.minText.replace('%0', this.formatDate(this.minValue)); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - if(this.maxValue && time > this.maxValue.getTime()){ - dom.title = this.maxText.replace('%0', this.formatDate(this.maxValue)); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - if(this.disabledDays){ - var day = value.getDay(); - for(var i = 0; i < this.disabledDays.length; i++) { - if(day === this.disabledDays[i]){ - dom.title = this.disabledDaysText; - this.element.addClass('ygrid-editor-invalid'); - return false; - } - } - } - var fvalue = this.formatDate(value); - if(this.ddMatch.test(fvalue)){ - dom.title = this.disabledDatesText.replace('%0', fvalue); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - var msg = this.validator(value); - if(msg !== true){ - dom.title = msg; - this.element.addClass('ygrid-editor-invalid'); - return false; - } - dom.title = ''; - this.element.removeClass('ygrid-editor-invalid'); - return true; - }, - - handleMouseDown : function(e){ - var t = e.getTarget(); - var dom = this.div.dom; - if(t != dom && !YAHOO.util.Dom.isAncestor(dom, t)){ - this.stopEditing(); - } - }, - - showCalendar : function(value){ - if(this.cal == null){ - this.cal = new YAHOO.ext.DatePicker(this.div.dom.parentNode.parentNode); - } - this.cal.minDate = this.minValue; - this.cal.maxDate = this.maxValue; - this.cal.disabledDatesRE = this.ddMatch; - this.cal.disabledDatesText = this.disabledDatesText; - this.cal.disabledDays = this.disabledDays; - this.cal.disabledDaysText = this.disabledDaysText; - this.cal.format = this.format; - if(this.minValue){ - this.cal.minText = this.minText.replace('%0', this.formatDate(this.minValue)); - } - if(this.maxValue){ - this.cal.maxText = this.maxText.replace('%0', this.formatDate(this.maxValue)); - } - var r = this.div.getRegion(); - this.cal.show(r.left, r.bottom, this.getValue(), this.setValue.createDelegate(this)); - }, - - parseDate : function(value){ - if(!value || value instanceof Date) return value; - return Date.parseDate(value, this.format); - }, - - formatDate : function(date){ - if(!date || !(date instanceof Date)) return date; - return date.format(this.format); - } -}; - -YAHOO.ext.grid.DateEditor.prototype.format = 'm/d/y'; -YAHOO.ext.grid.DateEditor.prototype.disabledDays = null; -YAHOO.ext.grid.DateEditor.prototype.disabledDaysText = ''; -YAHOO.ext.grid.DateEditor.prototype.disabledDates = null; -YAHOO.ext.grid.DateEditor.prototype.disabledDatesText = ''; -YAHOO.ext.grid.DateEditor.prototype.allowBlank = true; -YAHOO.ext.grid.DateEditor.prototype.minValue = null; -YAHOO.ext.grid.DateEditor.prototype.maxValue = null; -YAHOO.ext.grid.DateEditor.prototype.minText = 'The date in this field must be after %0'; -YAHOO.ext.grid.DateEditor.prototype.maxText = 'The date in this field must be before %0'; -YAHOO.ext.grid.DateEditor.prototype.blankText = 'This field cannot be blank'; -YAHOO.ext.grid.DateEditor.prototype.invalidText = '%0 is not a valid date - it must be in the format %1'; -YAHOO.ext.grid.DateEditor.prototype.validationDelay = 200; -YAHOO.ext.grid.DateEditor.prototype.validator = function(){return true;};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.DatePicker | -- |
YAHOO.ext.DatePicker = function(id, parentElement){ - this.id = id; - this.selectedDate = new Date(); - this.visibleDate = new Date(); - this.element = null; - this.shadow = null; - this.callback = null; - this.buildControl(parentElement || document.body); - this.mouseDownHandler = YAHOO.ext.EventManager.wrap(this.handleMouseDown, this, true); - this.keyDownHandler = YAHOO.ext.EventManager.wrap(this.handleKeyDown, this, true); - this.wheelHandler = YAHOO.ext.EventManager.wrap(this.handleMouseWheel, this, true); -}; - -YAHOO.ext.DatePicker.prototype = { - show : function(x, y, value, callback){ - this.hide(); - this.selectedDate = value; - this.visibleDate = value; - this.callback = callback; - this.refresh(); - this.element.show(); - this.element.moveTo(x, y); - this.shadow.show(); - this.shadow.setRegion(this.element.getRegion()); - this.element.dom.tabIndex = 1; - this.element.focus(); - YAHOO.util.Event.on(document, "mousedown", this.mouseDownHandler); - YAHOO.util.Event.on(document, "keydown", this.keyDownHandler); - YAHOO.util.Event.on(document, "mousewheel", this.wheelHandler); - YAHOO.util.Event.on(document, "DOMMouseScroll", this.wheelHandler); - }, - - hide : function(){ - this.shadow.hide(); - this.element.hide(); - YAHOO.util.Event.removeListener(document, "mousedown", this.mouseDownHandler); - YAHOO.util.Event.removeListener(document, "keydown", this.keyDownHandler); - YAHOO.util.Event.removeListener(document, "mousewheel", this.wheelHandler); - YAHOO.util.Event.removeListener(document, "DOMMouseScroll", this.wheelHandler); - }, - - setSelectedDate : function(date){ - this.selectedDate = date; - }, - - getSelectedDate : function(){ - return this.selectedDate; - }, - - showPrevMonth : function(){ - this.visibleDate = this.getPrevMonth(this.visibleDate); - this.refresh(); - }, - - showNextMonth : function(){ - this.visibleDate = this.getNextMonth(this.visibleDate); - this.refresh(); - }, - - showPrevYear : function(){ - var d = this.visibleDate; - this.visibleDate = new Date(d.getFullYear()-1, d.getMonth(), d.getDate()); - this.refresh(); - }, - - showNextYear : function(){ - var d = this.visibleDate; - this.visibleDate = new Date(d.getFullYear()+1, d.getMonth(), d.getDate()); - this.refresh(); - }, - - handleMouseDown : function(e){ - var target = e.getTarget(); - if(target != this.element.dom && !YAHOO.util.Dom.isAncestor(this.element.dom, target)){ - this.hide(); - } - }, - - handleKeyDown : function(e){ - switch(e.browserEvent.keyCode){ - case e.LEFT: - this.showPrevMonth(); - e.stopEvent(); - break; - case e.RIGHT: - this.showNextMonth(); - e.stopEvent(); - break; - case e.DOWN: - this.showPrevYear(); - e.stopEvent(); - break; - case e.UP: - this.showNextYear(); - e.stopEvent(); - break; - } - }, - - handleMouseWheel : function(e){ - var delta = e.getWheelDelta(); - if(delta > 0){ - this.showPrevMonth(); - e.stopEvent(); - } else if(delta < 0){ - this.showNextMonth(); - e.stopEvent(); - } - }, - - handleClick : function(e){ - var d = this.visibleDate; - var t = e.getTarget(); - if(t && t.className){ - switch(t.className){ - case 'active': - this.handleSelection(new Date(d.getFullYear(), d.getMonth(), parseInt(t.innerHTML))); - break; - case 'prevday': - var p = this.getPrevMonth(d); - this.handleSelection(new Date(p.getFullYear(), p.getMonth(), parseInt(t.innerHTML))); - break; - case 'nextday': - var n = this.getNextMonth(d); - this.handleSelection(new Date(n.getFullYear(), n.getMonth(), parseInt(t.innerHTML))); - break; - case 'ypopcal-today': - this.handleSelection(new Date()); - break; - case 'next-month': - this.showNextMonth(); - break; - case 'prev-month': - this.showPrevMonth(); - break; - } - } - e.stopEvent(); - }, - - selectToday : function(){ - this.handleSelection(new Date()); - }, - - handleSelection: function(date){ - this.selectedDate = date; - this.callback(date); - this.hide(); - }, - - getPrevMonth : function(d){ - var m = d.getMonth();var y = d.getFullYear(); - return (m == 0 ? new Date(--y, 11, 1) : new Date(y, --m, 1)); - }, - - getNextMonth : function(d){ - var m = d.getMonth();var y = d.getFullYear(); - return (m == 11 ? new Date(++y, 0, 1) : new Date(y, ++m, 1)); - }, - - getDaysInMonth : function(m, y){ - return (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) ? 31 : (m == 4 || m == 6 || m == 9 || m == 11) ? 30 : this.isLeapYear(y) ? 29 : 28; - }, - - isLeapYear : function(y){ - return (((y % 4) == 0) && ((y % 100) != 0) || ((y % 400) == 0)); - }, - - clearTime : function(date){ - if(date){ - date.setHours(0); - date.setMinutes(0); - date.setSeconds(0); - date.setMilliseconds(0); - } - return date; - }, - - refresh : function(){ - var d = this.visibleDate; - this.buildInnerCal(d); - this.calHead.update(this.monthNames[d.getMonth()] + ' ' + d.getFullYear()); - if(this.element.isVisible()){ - this.shadow.setRegion(this.element.getRegion()); - } - } -}; - -/** - * This code is not pretty, but it is fast! - * @ignore - */ -YAHOO.ext.DatePicker.prototype.buildControl = function(parentElement){ - var c = document.createElement('div'); - c.style.position = 'absolute'; - c.style.visibility = 'hidden'; - document.body.appendChild(c); - var html = '<iframe id="'+this.id+'_shdw" frameborder="0" style="position:absolute; z-index:2000; display:none; top:0px; left:0px;" class="ypopcal-shadow"></iframe>' + - '<div hidefocus="true" class="ypopcal" id="'+this.id+'" style="-moz-outline:none; position:absolute; z-index:2001; display:none; top:0px; left:0px;">' + - '<table class="ypopcal-head" border=0 cellpadding=0 cellspacing=0><tbody><tr><td class="ypopcal-arrow"><div class="prev-month"> </div></td><td class="ypopcal-month"> </td><td class="ypopcal-arrow"><div class="next-month"> </div></td></tr></tbody></table>' + - '<center><div class="ypopcal-inner">'; - html += "<table border=0 cellpadding=2 cellspacing=0 class=\"ypopcal-table\"><thead><tr class=\"ypopcal-daynames\">"; - var names = this.dayNames; - for(var i = 0; i < names.length; i++){ - html += '<td>' + names[i].substr(0, 1) + '</td>'; - } - html+= "</tr></thead><tbody><tr>"; - for(var i = 0; i < 42; i++) { - if(i % 7 == 0 && i != 0){ - html += '</tr><tr>'; - } - html += "<td> </td>"; - } - html += "</tr></tbody></table>"; - html += '</div><button class="ypopcal-today" style="margin-top:2px;">'+this.todayText+'</button></center></div>'; - c.innerHTML = html; - this.shadow = getEl(c.childNodes[0], true); - this.shadow.enableDisplayMode(); - this.element = getEl(c.childNodes[1], true); - this.element.enableDisplayMode(); - document.body.appendChild(this.shadow.dom); - document.body.appendChild(this.element.dom); - document.body.removeChild(c); - this.element.on("selectstart", function(){return false;}); - var tbody = this.element.dom.getElementsByTagName('tbody')[1]; - this.cells = tbody.getElementsByTagName('td'); - this.calHead = this.element.getChildrenByClassName('ypopcal-month', 'td')[0]; - this.element.mon('mousedown', this.handleClick, this, true); -}; - -YAHOO.ext.DatePicker.prototype.buildInnerCal = function(dateVal){ - var days = this.getDaysInMonth(dateVal.getMonth() + 1, dateVal.getFullYear()); - var firstOfMonth = new Date(dateVal.getFullYear(), dateVal.getMonth(), 1); - var startingPos = firstOfMonth.getDay(); - if(startingPos == 0) startingPos = 7; - var pm = this.getPrevMonth(dateVal); - var prevStart = this.getDaysInMonth(pm.getMonth()+1, pm.getFullYear())-startingPos; - var cells = this.cells; - days += startingPos; - - // convert everything to numbers so it's fast - var day = 86400000; - var date = this.clearTime(new Date(pm.getFullYear(), pm.getMonth(), prevStart)); - var today = this.clearTime(new Date()).getTime(); - var sel = this.selectedDate ? this.clearTime(this.selectedDate).getTime() : today + 1; //today +1 will never match anything - var min = this.minDate ? this.clearTime(this.minDate).getTime() : Number.NEGATIVE_INFINITY; - var max = this.maxDate ? this.clearTime(this.maxDate).getTime() : Number.POSITIVE_INFINITY; - var ddMatch = this.disabledDatesRE; - var ddText = this.disabledDatesText; - var ddays = this.disabledDays; - var ddaysText = this.disabledDaysText; - var format = this.format; - - var setCellClass = function(cal, cell, d){ - cell.title = ''; - var t = d.getTime(); - if(t == today){ - cell.className += ' today'; - cell.title = cal.todayText; - } - if(t == sel){ - cell.className += ' selected'; - } - // disabling - if(t < min) { - cell.className = ' ypopcal-disabled'; - cell.title = cal.minText; - return; - } - if(t > max) { - cell.className = ' ypopcal-disabled'; - cell.title = cal.maxText; - return; - } - if(ddays){ - var day = d.getDay(); - for(var i = 0; i < ddays.length; i++) { - if(day === ddays[i]){ - cell.title = ddaysText; - cell.className = ' ypopcal-disabled'; - return; - } - } - } - if(ddMatch && format){ - var fvalue = d.format(format); - if(ddMatch.test(fvalue)){ - cell.title = ddText.replace('%0', fvalue); - cell.className = ' ypopcal-disabled'; - return; - } - } - }; - - var i = 0; - for(; i < startingPos; i++) { - cells[i].innerHTML = (++prevStart); - date.setDate(date.getDate()+1); - cells[i].className = 'prevday'; - setCellClass(this, cells[i], date); - } - for(; i < days; i++){ - intDay = i - startingPos + 1; - cells[i].innerHTML = (intDay); - date.setDate(date.getDate()+1); - cells[i].className = 'active'; - setCellClass(this, cells[i], date); - } - var extraDays = 0; - for(; i < 42; i++) { - cells[i].innerHTML = (++extraDays); - date.setDate(date.getDate()+1); - cells[i].className = 'nextday'; - setCellClass(this, cells[i], date); - } -}; - -YAHOO.ext.DatePicker.prototype.todayText = "Today"; -YAHOO.ext.DatePicker.prototype.minDate = null; -YAHOO.ext.DatePicker.prototype.maxDate = null; -YAHOO.ext.DatePicker.prototype.minText = "This date is before the minimum date"; -YAHOO.ext.DatePicker.prototype.maxText = "This date is after the maximum date"; -YAHOO.ext.DatePicker.prototype.format = 'm/d/y'; -YAHOO.ext.DatePicker.prototype.disabledDays = null; -YAHOO.ext.DatePicker.prototype.disabledDaysText = ''; -YAHOO.ext.DatePicker.prototype.disabledDatesRE = null; -YAHOO.ext.DatePicker.prototype.disabledDatesText = ''; - - -YAHOO.ext.DatePicker.prototype.monthNames = Date.monthNames; - -YAHOO.ext.DatePicker.prototype.dayNames = Date.dayNames;-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.DefaultColumnModel | -This is the default implementation of a ColumnModel used by the Grid. | -
-/** - * @class - * This is the default implementation of a ColumnModel used by the Grid. It defines - * the columns in the grid. - * <br>Usage:<br> - * <pre><code> - * var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes; - * var myColumns = [ - {header: "Ticker", width: 60, sortable: true, sortType: sort.asUCString}, - {header: "Company Name", width: 150, sortable: true, sortType: sort.asUCString}, - {header: "Market Cap.", width: 100, sortable: true, sortType: sort.asFloat}, - {header: "$ Sales", width: 100, sortable: true, sortType: sort.asFloat, renderer: money}, - {header: "Employees", width: 100, sortable: true, sortType: sort.asFloat} - * ]; - * var colModel = new YAHOO.ext.grid.DefaultColumnModel(myColumns); - * </code></pre> - * @extends YAHOO.ext.grid.AbstractColumnModel - * @constructor -*/ -YAHOO.ext.grid.DefaultColumnModel = function(config){ - YAHOO.ext.grid.DefaultColumnModel.superclass.constructor.call(this); - /** - * The config passed into the constructor - */ - this.config = config; - - /** - * The width of columns which have no width specified (defaults to 100) - * @type Number - */ - this.defaultWidth = 100; - /** - * Default sortable of columns which have no sortable specified (defaults to false) - * @type Boolean - */ - this.defaultSortable = false; -}; -YAHOO.extendX(YAHOO.ext.grid.DefaultColumnModel, YAHOO.ext.grid.AbstractColumnModel); - -/** - * Returns the number of columns. - * @return {Number} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.getColumnCount = function(){ - return this.config.length; -}; - -/** - * Returns true if the specified column is sortable. - * @param {Number} col The column index - * @return {Boolean} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.isSortable = function(col){ - if(typeof this.config[col].sortable == 'undefined'){ - return this.defaultSortable; - } - return this.config[col].sortable; -}; - -/** - * Returns the sorting comparison function defined for the column (defaults to sortTypes.none). - * @param {Number} col The column index - * @return {Function} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.getSortType = function(col){ - if(!this.dataMap){ - // build a lookup so we don't search every time - var map = []; - for(var i = 0, len = this.config.length; i < len; i++){ - map[this.getDataIndex(i)] = i; - } - this.dataMap = map; - } - col = this.dataMap[col]; - if(!this.config[col].sortType){ - return YAHOO.ext.grid.DefaultColumnModel.sortTypes.none; - } - return this.config[col].sortType; -}; - -/** - * Sets the sorting comparison function for a column. - * @param {Number} col The column index - * @param {Function} fn - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.setSortType = function(col, fn){ - this.config[col].sortType = fn; -}; - - -/** - * Returns the rendering (formatting) function defined for the column. - * @param {Number} col The column index - * @return {Function} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.getRenderer = function(col){ - if(!this.config[col].renderer){ - return YAHOO.ext.grid.DefaultColumnModel.defaultRenderer; - } - return this.config[col].renderer; -}; - -/** - * Sets the rendering (formatting) function for a column. - * @param {Number} col The column index - * @param {Function} fn - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.setRenderer = function(col, fn){ - this.config[col].renderer = fn; -}; - -/** - * Returns the width for the specified column. - * @param {Number} col The column index - * @return {Number} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.getColumnWidth = function(col){ - return this.config[col].width || this.defaultWidth; -}; - -/** - * Sets the width for a column. - * @param {Number} col The column index - * @param {Number} width The new width - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.setColumnWidth = function(col, width, suppressEvent){ - this.config[col].width = width; - this.totalWidth = null; - if(!suppressEvent){ - this.onWidthChange.fireDirect(this, col, width); - } -}; - -/** - * Returns the total width of all columns. - * @param {Boolean} includeHidden True to include hidden column widths - * @return {Number} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.getTotalWidth = function(includeHidden){ - if(!this.totalWidth){ - this.totalWidth = 0; - for(var i = 0; i < this.config.length; i++){ - if(includeHidden || !this.isHidden(i)){ - this.totalWidth += this.getColumnWidth(i); - } - } - } - return this.totalWidth; -}; - -/** - * Returns the header for the specified column. - * @param {Number} col The column index - * @return {String} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.getColumnHeader = function(col){ - return this.config[col].header; -}; - -/** - * Sets the header for a column. - * @param {Number} col The column index - * @param {String} header The new header - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.setColumnHeader = function(col, header){ - this.config[col].header = header; - this.onHeaderChange.fireDirect(this, col, header); -}; -/** - * Returns the dataIndex for the specified column. - * @param {Number} col The column index - * @return {Number} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.getDataIndex = function(col){ - if(typeof this.config[col].dataIndex != 'number'){ - return col; - } - return this.config[col].dataIndex; -}; - -/** - * Sets the dataIndex for a column. - * @param {Number} col The column index - * @param {Number} dataIndex The new dataIndex - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.setDataIndex = function(col, dataIndex){ - this.config[col].dataIndex = dataIndex; -}; -/** - * Returns true if the cell is editable. - * @param {Number} colIndex The column index - * @param {Number} rowIndex The row index - * @return {Boolean} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.isCellEditable = function(colIndex, rowIndex){ - return this.config[colIndex].editable || (typeof this.config[colIndex].editable == 'undefined' && this.config[colIndex].editor); -}; - -/** - * Returns the editor defined for the cell/column. - * @param {Number} colIndex The column index - * @param {Number} rowIndex The row index - * @return {Object} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.getCellEditor = function(colIndex, rowIndex){ - return this.config[colIndex].editor; -}; - -/** - * Sets if a column is editable. - * @param {Number} col The column index - * @param {Boolean} editable True if the column is editable - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.setEditable = function(col, editable){ - this.config[col].editable = editable; -}; - - -/** - * Returns true if the column is hidden. - * @param {Number} colIndex The column index - * @return {Boolean} - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.isHidden = function(colIndex){ - return this.config[colIndex].hidden; -}; - -/** - * Sets if a column is hidden. - * @param {Number} colIndex The column index - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.setHidden = function(colIndex, hidden){ - this.config[colIndex].hidden = hidden; - this.totalWidth = null; - this.fireHiddenChange(colIndex, hidden); -}; - -/** - * Sets the editor for a column. - * @param {Number} col The column index - * @param {Object} editor The editor object - */ -YAHOO.ext.grid.DefaultColumnModel.prototype.setEditor = function(col, editor){ - this.config[col].editor = editor; -}; - - -/** - * Default empty rendering function - */ -YAHOO.ext.grid.DefaultColumnModel.defaultRenderer = function(value){ - if(typeof value == 'string' && value.length < 1){ - return ' '; - } - return value; -} - -/** - * Defines the default sorting (casting?) comparison functions used when sorting data: - * <br> sortTypes.none - sorts data as it is without casting or parsing (the default) - * <br> sortTypes.asUCString - case insensitive string - * <br> sortTypes.asDate - attempts to parse data as a date - * <br> sortTypes.asFloat - * <br> sortTypes.asInt - */ -YAHOO.ext.grid.DefaultColumnModel.sortTypes = {}; - -YAHOO.ext.grid.DefaultColumnModel.sortTypes.none = function(s) { - return s; -}; - -YAHOO.ext.grid.DefaultColumnModel.sortTypes.asUCString = function(s) { - return String(s).toUpperCase(); -}; - -YAHOO.ext.grid.DefaultColumnModel.sortTypes.asDate = function(s) { - if(s instanceof Date){ - return s; - } - return Date.parse(String(s)); -}; - -YAHOO.ext.grid.DefaultColumnModel.sortTypes.asFloat = function(s) { - var val = parseFloat(String(s).replace(/,/g, '')); - if(isNaN(val)) val = 0; - return val; -}; - -YAHOO.ext.grid.DefaultColumnModel.sortTypes.asInt = function(s) { - var val = parseInt(String(s).replace(/,/g, '')); - if(isNaN(val)) val = 0; - return val; -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.DefaultDataModel | -This is the default implementation of a DataModel used by the Grid. | -
-/** - * @class - * This is the default implementation of a DataModel used by the Grid. It works - * with multi-dimensional array based data. Using the event system in the base class - * {@link YAHOO.ext.grid.AbstractDataModel}, all updates to this DataModel are automatically - * reflected in the user interface. - * <br>Usage:<br> - * <pre><code> - * var myData = [ - ["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"], - ["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"] - * ]; - * var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData); - * </code></pre> - * @extends YAHOO.ext.grid.AbstractDataModel - * @constructor -*/ -YAHOO.ext.grid.DefaultDataModel = function(data){ - YAHOO.ext.grid.DefaultDataModel.superclass.constructor.call(this); - /**@private*/ - this.data = data; -}; -YAHOO.extendX(YAHOO.ext.grid.DefaultDataModel, YAHOO.ext.grid.AbstractDataModel); - -/** - * Returns the number of rows in the dataset - * @return {Number} - */ -YAHOO.ext.grid.DefaultDataModel.prototype.getRowCount = function(){ - return this.data.length; -}; - -/** - * Returns the ID of the specified row. By default it return the value of the first column. - * Override to provide more advanced ID handling. - * @return {Number} - */ -YAHOO.ext.grid.DefaultDataModel.prototype.getRowId = function(rowIndex){ - return this.data[rowIndex][0]; -}; - -/** - * Returns the column data for the specified row. - * @return {Array} - */ -YAHOO.ext.grid.DefaultDataModel.prototype.getRow = function(rowIndex){ - return this.data[rowIndex]; -}; - -/** - * Returns the column data for the specified rows as a - * multi-dimensional array: rows[3][0] would give you the value of row 4, column 0. - * @param {Array} indexes The row indexes to fetch - * @return {Array} - */ -YAHOO.ext.grid.DefaultDataModel.prototype.getRows = function(indexes){ - var data = this.data; - var r = []; - for(var i = 0; i < indexes.length; i++){ - r.push(data[indexes[i]]); - } - return r; -}; - -/** - * Returns the value at the specified data position - * @param {Number} rowIndex - * @param {Number} colIndex - * @return {Object} - */ -YAHOO.ext.grid.DefaultDataModel.prototype.getValueAt = function(rowIndex, colIndex){ - return this.data[rowIndex][colIndex]; -}; - -/** - * Sets the specified value at the specified data position - * @param {Object} value The new value - * @param {Number} rowIndex - * @param {Number} colIndex - */ -YAHOO.ext.grid.DefaultDataModel.prototype.setValueAt = function(value, rowIndex, colIndex){ - this.data[rowIndex][colIndex] = value; - this.fireCellUpdated(rowIndex, colIndex); -}; - -/** - * @private - * Removes the specified range of rows. - * @param {Number} startIndex - * @param {<i>Number</i>} endIndex (optional) Defaults to startIndex - */ -YAHOO.ext.grid.DefaultDataModel.prototype.removeRows = function(startIndex, endIndex){ - endIndex = endIndex || startIndex; - this.data.splice(startIndex, endIndex-startIndex+1); - this.fireRowsDeleted(startIndex, endIndex); -}; - -/** - * Remove a row. - * @param {Number} index - */ -YAHOO.ext.grid.DefaultDataModel.prototype.removeRow = function(index){ - this.data.splice(index, 1); - this.fireRowsDeleted(index, index); -}; - -/** - * @private - * Removes all rows. - */ -YAHOO.ext.grid.DefaultDataModel.prototype.removeAll = function(){ - var count = this.getRowCount(); - if(count > 0){ - this.removeRows(0, count-1); - } -}; - -/** - * Query the DataModel rows by the filters defined in spec, for example... - * <pre><code> - * // column 1 starts with Jack, column 2 filtered by myFcn, column 3 equals 'Fred' - * dataModel.filter({1: /^Jack.+/i}, 2: myFcn, 3: 'Fred'}); - * </code></pre> - * @param {Object} spec The spec is generally an object literal consisting of - * column index and filter type. The filter type can be a string/number (exact match), - * a regular expression to test using String.search() or a function to call. If it's a function, - * it will be called with the value for the specified column and an array of the all column - * values for that row: yourFcn(value, columnData). If it returns anything other than true, - * the row is not a match. - * @param {Boolean} returnUnmatched True to return rows which <b>don't</b> match the query instead - * of rows that do match - * @return {Array} An array of row indexes that match - */ -YAHOO.ext.grid.DefaultDataModel.prototype.query = function(spec, returnUnmatched){ - var d = this.data; - var r = []; - for(var i = 0; i < d.length; i++){ - var row = d[i]; - var isMatch = true; - for(var col in spec){ - if(typeof spec[col] != 'function'){ - if(!isMatch) continue; - var filter = spec[col]; - switch(typeof filter){ - case 'string': - case 'number': - case 'boolean': - if(row[col] != filter){ - isMatch = false; - } - break; - case 'function': - if(!filter(row[col], row)){ - isMatch = false; - } - break; - case 'object': - if(filter instanceof RegExp){ - if(String(row[col]).search(filter) === -1){ - isMatch = false; - } - } - break; - } - } - } - if(isMatch && !returnUnmatched){ - r.push(i); - }else if(!isMatch && returnUnmatched){ - r.push(i); - } - } - return r; -}; - -/** - * Filter the DataModel rows by the query defined in spec, see {@link #query} for more details - * on the query spec. - * @param {Object} query The query spec {@link #query} - * @return {Number} The number of rows removed - */ -YAHOO.ext.grid.DefaultDataModel.prototype.filter = function(query){ - var matches = this.query(query, true); - var data = this.data; - // go thru the data setting matches to deleted - // while not disturbing row indexes - for(var i = 0; i < matches.length; i++){ - data[matches[i]]._deleted = true; - } - for(var i = 0; i < data.length; i++){ - while(data[i] && data[i]._deleted === true){ - this.removeRow(i); - } - } - return matches.length; -}; - -/** - * Adds a row to the dataset. - * @param {Array} cellValues The array of values for the new row - * @return {Number} The index of the added row - */ -YAHOO.ext.grid.DefaultDataModel.prototype.addRow = function(cellValues){ - this.data.push(cellValues); - var newIndex = this.data.length-1; - this.fireRowsInserted(newIndex, newIndex); - this.applySort(); - return newIndex; -}; - -/** - * @private - * Adds a set of rows. - * @param {Array} rowData This should be an array of arrays like the constructor takes - */ -YAHOO.ext.grid.DefaultDataModel.prototype.addRows = function(rowData){ - this.data = this.data.concat(rowData); - var firstIndex = this.data.length-rowData.length; - this.fireRowsInserted(firstIndex, firstIndex+rowData.length-1); - this.applySort(); -}; - -/** - * Inserts a row a the specified location in the dataset. - * @param {Number} index The index where the row should be inserted - * @param {Array} cellValues The array of values for the new row - * @return {Number} The index the row was inserted in - */ -YAHOO.ext.grid.DefaultDataModel.prototype.insertRow = function(index, cellValues){ - this.data.splice(index, 0, cellValues); - this.fireRowsInserted(index, index); - this.applySort(); - return index; -}; - -/** - * @private - * Inserts a set of rows. - * @param {Number} index The index where the rows should be inserted - * @param {Array} rowData This should be an array of arrays like the constructor takes - */ -YAHOO.ext.grid.DefaultDataModel.prototype.insertRows = function(index, rowData){ - /* - if(index == this.data.length){ // try these two first since they are faster - this.data = this.data.concat(rowData); - }else if(index == 0){ - this.data = rowData.concat(this.data); - }else{ - var newData = this.data.slice(0, index); - newData.concat(rowData); - newData.concat(this.data.slice(index)); - this.data = newData; - }*/ - var args = rowData.concat(); - args.splice(0, 0, index, 0); - this.data.splice.apply(this.data, args); - this.fireRowsInserted(index, index+rowData.length-1); - this.applySort(); -}; - -/** - * Applies the last used sort to the current data. - */ -YAHOO.ext.grid.DefaultDataModel.prototype.applySort = function(suppressEvent){ - if(this.columnModel && typeof this.sortColumn != 'undefined'){ - this.sort(this.columnModel, this.sortColumn, this.sortDir, suppressEvent); - } -}; - -YAHOO.ext.grid.DefaultDataModel.prototype.setDefaultSort = function(columnModel, columnIndex, direction){ - this.columnModel = columnModel; - this.sortColumn = columnIndex; - this.sortDir = direction; -}; -/** - * Sorts the data by the specified column - Uses the sortType specified for the column in the passed columnModel. - * @param {YAHOO.ext.grid.DefaultColumnModel} columnModel The ColumnModel for this dataset - * @param {Number} columnIndex The column index to sort by - * @param {String} direction The direction of the sort ('DESC' or 'ASC') - */ -YAHOO.ext.grid.DefaultDataModel.prototype.sort = function(columnModel, columnIndex, direction, suppressEvent){ - // store these so we can maintain sorting when we load new data - this.columnModel = columnModel; - this.sortColumn = columnIndex; - this.sortDir = direction; - - var dsc = direction == 'DESC'; - var sortType = columnModel.getSortType(columnIndex); - var fn = function(cells, cells2){ - var v1 = sortType(cells[columnIndex], cells); - var v2 = sortType(cells2[columnIndex], cells2); - if(v1 < v2) - return dsc ? -1 : +1; - if(v1 > v2) - return dsc ? +1 : -1; - return 0; - }; - this.data.sort(fn); - if(!suppressEvent){ - this.fireRowsSorted(columnIndex, direction); - } -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.DomHelper.Template | -Represents an HTML fragment template - | -
/** - * @class - * Utility class for working with DOM - */ -YAHOO.ext.DomHelper = new function(){ - /**@private*/ - var d = document; - - /** True to force the use of DOM instead of html fragments @type Boolean */ - this.useDom = false; - - // parse and apply styles to dom element - /** @ignore */ - function applyStyles(el, styles){ - if(styles){ - var D = YAHOO.util.Dom; - var re = /\s?(.*?)\:(.*?);/g; - var matches; - while ((matches = re.exec(styles)) != null){ - D.setStyle(el, matches[1], matches[2]); - } - } - } - - // build as innerHTML where available - /** @ignore */ - function createHtml(o){ - var b = ''; - b += '<' + o.tag; - for(var attr in o){ - if(attr == 'tag' || attr == 'children' || attr == 'html' || typeof o[attr] == 'function') continue; - if(attr == 'cls'){ - b += ' class="' + o['cls'] + '"'; - }else{ - b += ' ' + attr + '="' + o[attr] + '"'; - } - } - b += '>'; - if(o.children){ - for(var i = 0, len = o.children.length; i < len; i++) { - b += createHtml(o.children[i], b); - } - } - if(o.html){ - b += o.html; - } - b += '</' + o.tag + '>'; - return b; - } - - // build as dom - /** @ignore */ - function createDom(o, parentNode){ - var el = d.createElement(o.tag); - var useSet = el.setAttribute ? true : false; // In IE some elements don't have setAttribute - for(var attr in o){ - if(attr == 'tag' || attr == 'children' || attr == 'html' || attr == 'style' || typeof o[attr] == 'function') continue; - if(attr=='cls'){ - el.className = o['cls']; - }else{ - if(useSet) el.setAttribute(attr, o[attr]); - else el[attr] = o[attr]; - } - } - applyStyles(el, o.style); - if(o.children){ - for(var i = 0, len = o.children.length; i < len; i++) { - createDom(o.children[i], el); - } - } - if(o.html){ - el.innerHTML = o.html; - } - if(parentNode){ - parentNode.appendChild(el); - } - return el; - } - - /** - * Inserts an HTML fragment into the Dom - * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd. - * @param {HTMLElement} el The context element - * @param {String} html The HTML fragmenet - * @return {HTMLElement} The new node - */ - this.insertHtml = function(where, el, html){ - if(el.insertAdjacentHTML){ - if(where == 'beforeBegin'){ - el.insertAdjacentHTML(where, html); - return el.previousSibling; - }else if(where == 'afterBegin'){ - el.insertAdjacentHTML(where, html); - return el.firstChild; - }else if(where == 'beforeEnd'){ - el.insertAdjacentHTML(where, html); - return el.lastChild; - }else if(where == 'afterEnd'){ - el.insertAdjacentHTML(where, html); - return el.nextSibling; - } - throw 'Illegal insertion point -> "' + where + '"'; - } - var range = el.ownerDocument.createRange(); - var frag; - if(where == 'beforeBegin'){ - range.setStartBefore(el); - frag = range.createContextualFragment(html); - el.parentNode.insertBefore(frag, el); - return el.previousSibling; - }else if(where == 'afterBegin'){ - range.selectNodeContents(el); - range.collapse(true); - frag = range.createContextualFragment(html); - el.insertBefore(frag, el.firstChild); - return el.firstChild; - }else if(where == 'beforeEnd'){ - range.selectNodeContents(el); - range.collapse(false); - frag = range.createContextualFragment(html); - el.appendChild(frag); - return el.lastChild; - }else if(where == 'afterEnd'){ - range.setStartAfter(el); - frag = range.createContextualFragment(html); - el.parentNode.insertBefore(frag, el.nextSibling); - return el.nextSibling; - }else{ - throw 'Illegal insertion point -> "' + where + '"'; - } - }; - - /** - * Creates new Dom element(s) and inserts them before el - * @param {HTMLElement} el The context element - * @param {Object} o The Dom object spec (and children) - * @return {HTMLElement} The new node - */ - this.insertBefore = function(el, o){ - el = YAHOO.util.Dom.get(el); - var newNode; - if(this.useDom){ - newNode = createDom(o, null); - el.parentNode.insertBefore(newNode, el); - }else{ - var html = createHtml(o); - newNode = this.insertHtml('beforeBegin', el, html); - } - return newNode; - }; - - /** - * Creates new Dom element(s) and inserts them after el - * @param {HTMLElement} el The context element - * @param {Object} o The Dom object spec (and children) - * @return {HTMLElement} The new node - */ - this.insertAfter = function(el, o){ - el = YAHOO.util.Dom.get(el); - var newNode; - if(this.useDom){ - newNode = createDom(o, null); - el.parentNode.insertBefore(newNode, el.nextSibling); - }else{ - var html = createHtml(o); - newNode = this.insertHtml('afterEnd', el, html); - } - return newNode; - }; - - /** - * Creates new Dom element(s) and appends them to el - * @param {HTMLElement} el The context element - * @param {Object} o The Dom object spec (and children) - * @return {HTMLElement} The new node - */ - this.append = function(el, o){ - el = YAHOO.util.Dom.get(el); - var newNode; - if(this.useDom){ - newNode = createDom(o, null); - el.appendChild(newNode); - }else{ - var html = createHtml(o); - newNode = this.insertHtml('beforeEnd', el, html); - } - return newNode; - }; - - /** - * Creates new Dom element(s) and overwrites the contents of el with them - * @param {HTMLElement} el The context element - * @param {Object} o The Dom object spec (and children) - * @return {HTMLElement} The new node - */ - this.overwrite = function(el, o){ - el = YAHOO.util.Dom.get(el); - el.innerHTML = createHtml(o); - return el.firstChild; - }; - - /** - * Creates a new YAHOO.ext.DomHelper.Template from the Dom object spec - * @param {Object} o The Dom object spec (and children) - * @return {YAHOO.ext.DomHelper.Template} The new template - */ - this.createTemplate = function(o){ - var html = createHtml(o); - return new YAHOO.ext.DomHelper.Template(html); - }; -}(); - -/** -* @class -* Represents an HTML fragment template -* @constructor -* @param {String} html The HTML fragment -*/ -YAHOO.ext.DomHelper.Template = function(html){ - /**@private*/ - this.html = html; - /**@private*/ - this.re = /\{(\w+)\}/g; -}; -YAHOO.ext.DomHelper.Template.prototype = { - /** - * Returns an HTML fragment of this template with the specified values applied - * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) - * @return {String} - */ - applyTemplate : function(values){ - if(this.compiled){ - return this.compiled(values); - } - var empty = ''; - var fn = function(match, index){ - if(typeof values[index] != 'undefined'){ - return values[index]; - }else{ - return empty; - } - } - return this.html.replace(this.re, fn); - }, - - /** - * Compiles the template into an internal function, eliminating the RegEx overhead - */ - compile : function(){ - var html = this.html; - var re = /\{(\w+)\}/g; - var body = []; - body.push("this.compiled = function(values){ return "); - var result; - var lastMatchEnd = 0; - while ((result = re.exec(html)) != null){ - body.push("'", html.substring(lastMatchEnd, result.index), "' + "); - body.push("values[", html.substring(result.index+1,re.lastIndex-1), "] + "); - lastMatchEnd = re.lastIndex; - } - body.push("'", html.substr(lastMatchEnd), "';};"); - eval(body.join('')); - }, - - /** - * Applies the supplied values to the template and inserts the new node(s) before el - * @param {HTMLElement} el The context element - * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) - * @return {HTMLElement} The new node - */ - insertBefore: function(el, values){ - el = YAHOO.util.Dom.get(el); - return YAHOO.ext.DomHelper.insertHtml('beforeBegin', el, this.applyTemplate(values)); - }, - - /** - * Applies the supplied values to the template and inserts the new node(s) after el - * @param {HTMLElement} el The context element - * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) - * @return {HTMLElement} The new node - */ - insertAfter : function(el, values){ - el = YAHOO.util.Dom.get(el); - return YAHOO.ext.DomHelper.insertHtml('afterEnd', el, this.applyTemplate(values)); - }, - - /** - * Applies the supplied values to the template and append the new node(s) to el - * @param {HTMLElement} el The context element - * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) - * @return {HTMLElement} The new node - */ - append : function(el, values){ - el = YAHOO.util.Dom.get(el); - return YAHOO.ext.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(values)); - }, - - /** - * Applies the supplied values to the template and overwrites the content of el with the new node(s) - * @param {HTMLElement} el The context element - * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) - * @return {HTMLElement} The new node - */ - overwrite : function(el, values){ - el = YAHOO.util.Dom.get(el); - el.innerHTML = ''; - return YAHOO.ext.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(values)); - } -};-
- - - -
- - - - - - - - --YAHOO.ext.grid.EditorGrid = function(container, dataModel, colModel){ - YAHOO.ext.grid.EditorGrid.superclass.constructor.call(this, container, dataModel, - colModel, new YAHOO.ext.grid.EditorSelectionModel()); - this.container.addClass('yeditgrid'); -}; -YAHOO.extendX(YAHOO.ext.grid.EditorGrid, YAHOO.ext.grid.Grid);-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.EditorAndSelectionModel | -- |
| YAHOO.ext.grid.EditorSelectionModel | -Extends YAHOO.ext.grid.DefaultSelectionModel to enable cell navigation. | -
-/** - @class Extends {@link YAHOO.ext.grid.DefaultSelectionModel} to enable cell navigation. <br><br> - @extends YAHOO.ext.grid.DefaultSelectionModel - @constructor - */ -YAHOO.ext.grid.EditorSelectionModel = function(){ - YAHOO.ext.grid.EditorSelectionModel.superclass.constructor.call(this); - /** Number of clicks to activate a cell (for editing) - valid values are 1 or 2 - * @type Number */ - this.clicksToActivateCell = 1; - this.events['cellactivate'] = new YAHOO.util.CustomEvent('cellactivate'); -}; - -YAHOO.extendX(YAHOO.ext.grid.EditorSelectionModel, YAHOO.ext.grid.DefaultSelectionModel); - -YAHOO.ext.grid.EditorSelectionModel.prototype.disableArrowNavigation = false; -YAHOO.ext.grid.EditorSelectionModel.prototype.controlForArrowNavigation = false; - -/** @ignore */ -YAHOO.ext.grid.EditorSelectionModel.prototype.initEvents = function(){ - this.grid.addListener("cellclick", this.onCellClick, this, true); - this.grid.addListener("celldblclick", this.onCellDblClick, this, true); - this.grid.addListener("keydown", this.keyDown, this, true); -}; - -YAHOO.ext.grid.EditorSelectionModel.prototype.onCellClick = function(grid, rowIndex, colIndex){ - if(this.clicksToActivateCell == 1){ - var row = this.grid.getRow(rowIndex); - var cell = row.childNodes[colIndex]; - if(cell){ - this.activate(row, cell); - } - } -}; - -YAHOO.ext.grid.EditorSelectionModel.prototype.activate = function(row, cell){ - this.fireEvent('cellactivate', this, row, cell); - this.grid.doEdit(row, cell); -}; - -YAHOO.ext.grid.EditorSelectionModel.prototype.onCellDblClick = function(grid, rowIndex, colIndex){ - if(this.clicksToActivateCell == 2){ - var row = this.grid.getRow(rowIndex); - var cell = row.childNodes[colIndex]; - if(cell){ - this.activate(row, cell); - } - } -}; - -/** @ignore */ -YAHOO.ext.grid.EditorSelectionModel.prototype.setRowState = function(row, selected){ - YAHOO.ext.grid.EditorSelectionModel.superclass.setRowState.call(this, row, false, false); -}; -/** @ignore */ -YAHOO.ext.grid.EditorSelectionModel.prototype.focusRow = function(row, selected){ -}; - -YAHOO.ext.grid.EditorSelectionModel.prototype.getEditorCellAfter = function(cell, spanRows){ - var g = this.grid; - var next = g.getCellAfter(cell); - while(next && !g.colModel.isCellEditable(next.columnIndex)){ - next = g.getCellAfter(next); - } - if(!next && spanRows){ - var row = g.getRowAfter(g.getRowFromChild(cell)); - next = g.getFirstCell(row); - if(!g.colModel.isCellEditable(next.columnIndex)){ - next = this.getEditorCellAfter(next); - } - } - return next; -}; - -YAHOO.ext.grid.EditorSelectionModel.prototype.getEditorCellBefore = function(cell, spanRows){ - var g = this.grid; - var prev = g.getCellBefore(cell); - while(prev && !g.colModel.isCellEditable(prev.columnIndex)){ - prev = g.getCellBefore(prev); - } - if(!prev && spanRows){ - var row = g.getRowBefore(g.getRowFromChild(cell)); - prev = g.getLastCell(row); - if(!g.colModel.isCellEditable(prev.columnIndex)){ - prev = this.getEditorCellBefore(prev); - } - } - return prev; -}; - -YAHOO.ext.grid.EditorSelectionModel.prototype.allowArrowNav = function(e){ - return (!this.disableArrowNavigation && (!this.controlForArrowNavigation || e.ctrlKey)); -} -/** @ignore */ -YAHOO.ext.grid.EditorSelectionModel.prototype.keyDown = function(e){ - var g = this.grid, cm = g.colModel, cell = g.getEditingCell(); - if(!cell) return; - var newCell; - switch(e.browserEvent.keyCode){ - case e.TAB: - if(e.shiftKey){ - newCell = this.getEditorCellBefore(cell, true); - }else{ - newCell = this.getEditorCellAfter(cell, true); - } - break; - case e.DOWN: - if(this.allowArrowNav(e)){ - var next = g.getRowAfter(g.getRowFromChild(cell)); - if(next){ - newCell = next.childNodes[cell.columnIndex]; - } - } - break; - case e.UP: - if(this.allowArrowNav(e)){ - var prev = g.getRowBefore(g.getRowFromChild(cell)); - if(prev){ - newCell = prev.childNodes[cell.columnIndex]; - } - } - break; - case e.RETURN: - if(e.shiftKey){ - var prev = g.getRowBefore(g.getRowFromChild(cell)); - if(prev){ - newCell = prev.childNodes[cell.columnIndex]; - } - }else{ - var next = g.getRowAfter(g.getRowFromChild(cell)); - if(next){ - newCell = next.childNodes[cell.columnIndex]; - } - } - break; - case e.RIGHT: - if(this.allowArrowNav(e)){ - newCell = this.getEditorCellAfter(cell); - } - break; - case e.LEFT: - if(this.allowArrowNav(e)){ - newCell = this.getEditorCellBefore(cell); - } - break; - }; - if(newCell){ - this.activate(g.getRowFromChild(newCell), newCell); - e.stopEvent(); - } -}; - -YAHOO.ext.grid.EditorAndSelectionModel = function(){ - YAHOO.ext.grid.EditorAndSelectionModel.superclass.constructor.call(this); - this.events['cellactivate'] = new YAHOO.util.CustomEvent('cellactivate'); -}; - -YAHOO.extendX(YAHOO.ext.grid.EditorAndSelectionModel, YAHOO.ext.grid.DefaultSelectionModel); - -YAHOO.ext.grid.EditorAndSelectionModel.prototype.initEvents = function(){ - YAHOO.ext.grid.EditorAndSelectionModel.superclass.initEvents.call(this); - this.grid.addListener("celldblclick", this.onCellDblClick, this, true); -}; - -YAHOO.ext.grid.EditorAndSelectionModel.prototype.onCellDblClick = function(grid, rowIndex, colIndex){ - var row = this.grid.getRow(rowIndex); - var cell = row.childNodes[colIndex]; - if(cell){ - this.fireEvent('cellactivate', this, row, cell); - this.grid.doEdit(row, cell); - } -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.Element | -Wraps around a DOM element and provides convenient access to Yahoo
- UI library functionality. - Usage: -
- Using YAHOO.ext.Element.get() instead of calling the constructor directly ensures you get the same object
- each call instead of constructing a new one.- |
-
/** - * @class Wraps around a DOM element and provides convenient access to Yahoo - * UI library functionality.<br><br> - * Usage:<br> - * <pre><code> - * var el = YAHOO.ext.Element.get('myElementId'); - * // or the shorter - * var el = getEl('myElementId'); - * </code></pre> - * Using YAHOO.ext.Element.get() instead of calling the constructor directly ensures you get the same object - * each call instead of constructing a new one.<br> - * @requires YAHOO.util.Dom - * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent - * @requires YAHOO.util.Anim (optional) to support animation - * @requires YAHOO.util.Motion (optional) to support animation - * @requires YAHOO.util.Easing (optional) to support animation - * @constructor Create a new Element directly. - * @param {String} elementId - * @param {<i>Boolean</i>} forceNew (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class). - */ -YAHOO.ext.Element = function(elementId, forceNew){ - var dom = YAHOO.util.Dom.get(elementId); - if(!dom){ // invalid id/element - return; - } - if(!forceNew && YAHOO.ext.Element.cache[dom.id]){ // element object already exists - return YAHOO.ext.Element.cache[dom.id]; - } - /** - * The DOM element - * @type HTMLElement - */ - this.dom = dom; - /** - * The DOM element ID - * @type String - */ - this.id = this.dom.id; - /** - * @private the current visibility mode - */ - this.visibilityMode = YAHOO.ext.Element.VISIBILITY; - - - /** - * @private the element's default display mode - */ - this.originalDisplay = YAHOO.util.Dom.getStyle(this.dom, 'display'); - if (!this.originalDisplay || this.originalDisplay == 'none') { - this.originalDisplay = ''; - } - - /** - * The default unit to append to CSS values where a unit isn't provided (Defaults to px). - * @type String - */ - this.defaultUnit = 'px'; - - /** - * @private the element's default overflow - */ - this.originalClip = YAHOO.util.Dom.getStyle(this.dom, 'overflow'); - - - /** - * Fires when visibility changes. Uses fireDirect with signature: (oElement, boolean isVisible) - * @type CustomEvent - */ - this.onVisibilityChanged = new YAHOO.util.CustomEvent('visibilityChanged'); - - /** - * Fires when element moves. Uses fireDirect with signature: (oElement, newX, newY) - * @type CustomEvent - */ - this.onMoved = new YAHOO.util.CustomEvent('moved'); - - /** - * Fires when element is resized. Uses fireDirect with signature: (oElement, newWidth, newHeight) - * @type CustomEvent - */ - this.onResized = new YAHOO.util.CustomEvent('resized'); - - // The delegates below handle setting of 'this' when being called from other objects. - - /** - * @private - */ - this.visibilityDelegate = this.fireVisibilityChanged.createDelegate(this); - /** - * @private - */ - this.resizedDelegate = this.fireResized.createDelegate(this); - /** - * @private - */ - this.movedDelegate = this.fireMoved.createDelegate(this); -} - -YAHOO.ext.Element.prototype = { - // Utility methods to make firing events painless. - /** - *@private - */ - fireMoved : function(){ - this.onMoved.fireDirect(this, this.getX(), this.getY()); - }, - - /** - *@private - */ - fireVisibilityChanged : function(){ - this.onVisibilityChanged.fireDirect(this, this.isVisible()); - }, - - /** - *@private - */ - fireResized : function(){ - this.onResized.fireDirect(this, this.getWidth(), this.getHeight()); - }, - - /** - * Sets the elements visibility mode. When setVisible() is called it - * will use this to determine whether to set the visibility or the display property. - * @param visMode Element.VISIBILITY or Element.DISPLAY - */ - setVisibilityMode : function(visMode){ - this.visibilityMode = visMode; - }, - - /** - * Convenience method for setVisibilityMode(Element.DISPLAY) - */ - enableDisplayMode : function(){ - this.setVisibilityMode(YAHOO.ext.Element.DISPLAY) - }, - - /** - * Perform Yahoo UI animation on this element. - * @param {Object} args The YUI animation control args - * @param {<i>Float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - * @param {<i>Function</i>} animType (optional) YAHOO.util.Anim subclass to use. For example: YAHOO.util.Motion - */ - animate : function(args, duration, onComplete, easing, animType){ - this.anim(args, duration, onComplete, easing, animType); - }, - - /** - * @private Internal animation call - */ - anim : function(args, duration, onComplete, easing, animType){ - animType = animType || YAHOO.util.Anim; - var anim = new animType(this.dom, args, duration || .35, - easing || YAHOO.util.Easing.easeBoth); - if(onComplete){ - if(!(onComplete instanceof Array)){ - anim.onComplete.subscribe(onComplete); - }else{ - for(var i = 0; i < onComplete.length; i++){ - var fn = onComplete[i]; - if(fn) anim.onComplete.subscribe(fn); - } - } - } - anim.animate(); - }, - - /** - * Checks whether the element is currently visible using both visibility and display properties. - * @param {<i>Boolean</i>} deep True to walk the dom and see if parent elements are hidden - * @return {Boolean} Whether the element is currently visible - */ - isVisible : function(deep) { - var vis = YAHOO.util.Dom.getStyle(this.dom, 'visibility') != 'hidden' - && YAHOO.util.Dom.getStyle(this.dom, 'display') != 'none'; - if(!deep || !vis){ - return vis; - } - var p = this.dom.parentNode; - while(p && p.tagName.toLowerCase() != 'body'){ - if(YAHOO.util.Dom.getStyle(p, 'visibility') == 'hidden' || YAHOO.util.Dom.getStyle(p, 'display') == 'none'){ - return false; - } - p = p.parentNode; - } - return true; - }, - - /** - * Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use - * the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property. - * @param {Boolean} visible Whether the element is visible - * @param {<i>Boolean</i>} animate (optional) Fade the element in or out (Default is false) - * @param {<i>Float</i>} duration (optional) How long the fade effect lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut for hiding or YAHOO.util.Easing.easeIn for showing) - */ - setVisible : function(visible, animate, duration, onComplete, easing){ - //if(this.isVisible() == visible) return; // nothing to do - if(!animate || !YAHOO.util.Anim){ - if(this.visibilityMode == YAHOO.ext.Element.DISPLAY){ - this.setDisplayed(visible); - }else{ - YAHOO.util.Dom.setStyle(this.dom, 'visibility', visible ? 'visible' : 'hidden'); - } - this.fireVisibilityChanged(); - }else{ - // make sure they can see the transition - YAHOO.util.Dom.setStyle(this.dom, 'visibility', 'visible'); - if(this.visibilityMode == YAHOO.ext.Element.DISPLAY){ - this.setDisplayed(true); - } - var args = {opacity: { from: (visible?0:1), to: (visible?1:0) }}; - var anim = new YAHOO.util.Anim(this.dom, args, duration || .35, - easing || (visible ? YAHOO.util.Easing.easeIn : YAHOO.util.Easing.easeOut)); - anim.onComplete.subscribe((function(){ - if(this.visibilityMode == YAHOO.ext.Element.DISPLAY){ - this.setDisplayed(visible); - }else{ - YAHOO.util.Dom.setStyle(this.dom, 'visibility', visible ? 'visible' : 'hidden'); - } - this.fireVisibilityChanged(); - }).createDelegate(this)); - if(onComplete){ - anim.onComplete.subscribe(onComplete); - } - anim.animate(); - } - }, - - /** - *@private - */ - isDisplayed : function() { - return YAHOO.util.Dom.getStyle(this.dom, 'display') != 'none'; - }, - - /** - * Toggles the elements visibility or display, depending on visibility mode. - * @param {<i>Boolean</i>} animate (optional) Fade the element in or out (Default is false) - * @param {<i>float</i>} duration (optional) How long the fade effect lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut for hiding or YAHOO.util.Easing.easeIn for showing) - */ - toggle : function(animate, duration, onComplete, easing){ - this.setVisible(!this.isVisible(), animate, duration, onComplete, easing); - }, - - /** - *@private - */ - setDisplayed : function(value) { - YAHOO.util.Dom.setStyle(this.dom, 'display', value ? this.originalDisplay : 'none'); - }, - - /** - * Tries to focus the element. Any exceptions are caught. - */ - focus : function() { - try{ - this.dom.focus(); - }catch(e){} - }, - - /** - * Add a CSS class to the element. - * @param {String} className The CSS class to add - */ - addClass : function(className){ - YAHOO.util.Dom.addClass(this.dom, className); - }, - - /** - * Adds the passed className to this element and removes the class from all siblings - */ - radioClass : function(className){ - var siblings = this.dom.parentNode.childNodes; - for(var i = 0; i < siblings.length; i++) { - var s = siblings[i]; - if(s.nodeType == 1){ - YAHOO.util.Dom.removeClass(s, className); - } - } - YAHOO.util.Dom.addClass(this.dom, className); - }, - /** - * Removes a CSS class from the element. - * @param {String} className The CSS class to remove - */ - removeClass : function(className){ - YAHOO.util.Dom.removeClass(this.dom, className); - }, - - toggleClass : function(className){ - if(YAHOO.util.Dom.hasClass(this.dom, className)){ - YAHOO.util.Dom.removeClass(this.dom, className); - }else{ - YAHOO.util.Dom.addClass(this.dom, className); - } - }, - - /** - * Checks if a CSS class is in use by the element. - * @param {String} className The CSS class to check - * @return {Boolean} true or false - */ - hasClass : function(className){ - return YAHOO.util.Dom.hasClass(this.dom, className); - }, - - /** - * Replaces a CSS class on the element with another. - * @param {String} oldClassName The CSS class to replace - * @param {String} newClassName The replacement CSS class - */ - replaceClass : function(oldClassName, newClassName){ - YAHOO.util.Dom.replaceClass(this.dom, oldClassName, newClassName); - }, - - /** - * Normalizes currentStyle and ComputedStyle. - * @param {String} property The style property whose value is returned. - * @return {String} The current value of the style property for this element. - */ - getStyle : function(name){ - return YAHOO.util.Dom.getStyle(this.dom, name); - }, - - /** - * Wrapper for setting style properties - * @param {String} property The style property to be set. - * @param {String} val The value to apply to the given property. - */ - setStyle : function(name, value){ - YAHOO.util.Dom.setStyle(this.dom, name, value); - }, - - /** - * Gets the current X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - @ return {String} The X position of the element - */ - getX : function(){ - return YAHOO.util.Dom.getX(this.dom); - }, - - /** - * Gets the current Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - @ return {String} The Y position of the element - */ - getY : function(){ - return YAHOO.util.Dom.getY(this.dom); - }, - - /** - * Gets the current position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - @ return {Array} The XY position of the element - */ - getXY : function(){ - return YAHOO.util.Dom.getXY(this.dom); - }, - - /** - * Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - @param {String} The X position of the element - */ - setX : function(x){ - YAHOO.util.Dom.setX(this.dom, x); - this.fireMoved(); - }, - - /** - * Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - @param {String} The Y position of the element - */ - setY : function(y){ - YAHOO.util.Dom.setY(this.dom, y); - this.fireMoved(); - }, - - /** - * Set the element's X position directly using CSS style (instead of setX()) - * @param {String} left The left CSS property value - */ - setLeft : function(left){ - YAHOO.util.Dom.setStyle(this.dom, 'left', this.addUnits(left)); - this.fireMoved(); - }, - - /** - * Set the element's Y position directly using CSS style (instead of setY()) - * @param {String} top The top CSS property value - */ - setTop : function(top){ - YAHOO.util.Dom.setStyle(this.dom, 'top', this.addUnits(top)); - this.fireMoved(); - }, - - /** - * Set the element's css right style - * @param {String} left The right CSS property value - */ - setRight : function(right){ - YAHOO.util.Dom.setStyle(this.dom, 'right', this.addUnits(right)); - this.fireMoved(); - }, - - /** - * Set the element's css bottom style - * @param {String} top The bottom CSS property value - */ - setBottom : function(bottom){ - YAHOO.util.Dom.setStyle(this.dom, 'bottom', this.addUnits(bottom)); - this.fireMoved(); - }, - - /** - * Set the position of the element in page coordinates, regardless of how the element is positioned. - * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - * @param {Array} pos Contains X & Y [x, y] values for new position (coordinates are page-based) - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - setXY : function(pos, animate, duration, onComplete, easing){ - if(!animate || !YAHOO.util.Anim){ - YAHOO.util.Dom.setXY(this.dom, pos); - this.fireMoved(); - }else{ - this.anim({points: {to: pos}}, duration, [onComplete, this.movedDelegate], easing, YAHOO.util.Motion); - } - }, - - /** - * Set the position of the element in page coordinates, regardless of how the element is positioned. - * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - * @param {Number} x X value for new position (coordinates are page-based) - * @param {Number} y Y value for new position (coordinates are page-based) - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - setLocation : function(x, y, animate, duration, onComplete, easing){ - this.setXY([x, y], animate, duration, onComplete, easing); - }, - - /** - * Set the position of the element in page coordinates, regardless of how the element is positioned. - * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). - * @param {Number} x X value for new position (coordinates are page-based) - * @param {Number} y Y value for new position (coordinates are page-based) - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - moveTo : function(x, y, animate, duration, onComplete, easing){ - //YAHOO.util.Dom.setStyle(this.dom, 'left', this.addUnits(x)); - //YAHOO.util.Dom.setStyle(this.dom, 'top', this.addUnits(y)); - this.setXY([x, y], animate, duration, onComplete, easing); - }, - - /** - * Returns the region position of the given element. - * The element must be part of the DOM tree to have a region (display:none or elements not appended return false). - * @return {Region} A YAHOO.util.Region containing "top, left, bottom, right" member data. - */ - getRegion : function(){ - return YAHOO.util.Dom.getRegion(this.dom); - }, - - /** - * Returns the offset height of the element - * @return {Number} The element's height - */ - getHeight : function(){ - return this.dom.offsetHeight; - }, - - /** - * Returns the offset width of the element - * @return {Number} The element's width - */ - getWidth : function(){ - return this.dom.offsetWidth; - }, - - /** - * Returns the size of the element - * @return {Object} An object containing the element's size {width: (element width), height: (element height)} - */ - getSize : function(){ - return {width: this.getWidth(), height: this.getHeight()}; - }, - - /** @private */ - adjustWidth : function(width){ - if(this.autoBoxAdjust && typeof width == 'number' && !this.isBorderBox()){ - width -= (this.getBorderWidth('lr') + this.getPadding('lr')); - } - return width; - }, - - /** @private */ - adjustHeight : function(height){ - if(this.autoBoxAdjust && typeof height == 'number' && !this.isBorderBox()){ - height -= (this.getBorderWidth('tb') + this.getPadding('tb')); - } - return height; - }, - - /** - * Set the width of the element - * @param {Number} width The new width - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut if width is larger or YAHOO.util.Easing.easeIn if it is smaller) - */ - setWidth : function(width, animate, duration, onComplete, easing){ - width = this.adjustWidth(width); - if(!animate || !YAHOO.util.Anim){ - YAHOO.util.Dom.setStyle(this.dom, 'width', this.addUnits(width)); - this.fireResized(); - }else{ - this.anim({width: {to: width}}, duration, [onComplete, this.resizedDelegate], - easing || (width > this.getWidth() ? YAHOO.util.Easing.easeOut : YAHOO.util.Easing.easeIn)); - } - }, - - /** - * Set the height of the element - * @param {Number} height The new height - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut if height is larger or YAHOO.util.Easing.easeIn if it is smaller) - */ - setHeight : function(height, animate, duration, onComplete, easing){ - height = this.adjustHeight(height); - if(!animate || !YAHOO.util.Anim){ - YAHOO.util.Dom.setStyle(this.dom, 'height', this.addUnits(height)); - this.fireResized(); - }else{ - this.anim({height: {to: height}}, duration, [onComplete, this.resizedDelegate], - easing || (height > this.getHeight() ? YAHOO.util.Easing.easeOut : YAHOO.util.Easing.easeIn)); - } - }, - - /** - * Set the size of the element. If animation is true, both width an height will be animated concurrently. - * @param {Number} width The new width - * @param {Number} height The new height - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - setSize : function(width, height, animate, duration, onComplete, easing){ - if(!animate || !YAHOO.util.Anim){ - this.setWidth(width); - this.setHeight(height); - this.fireResized(); - }else{ - width = this.adjustWidth(width); height = this.adjustHeight(height); - this.anim({width: {to: width}, height: {to: height}}, duration, [onComplete, this.resizedDelegate], easing); - } - }, - - /** - * Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently. - * @param {Number} x X value for new position (coordinates are page-based) - * @param {Number} y Y value for new position (coordinates are page-based) - * @param {Number} width The new width - * @param {Number} height The new height - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - setBounds : function(x, y, width, height, animate, duration, onComplete, easing){ - if(!animate || !YAHOO.util.Anim){ - this.setWidth(width); - this.setHeight(height); - this.setLocation(x, y); - this.fireResized(); - this.fireMoved(); - }else{ - width = this.adjustWidth(width); height = this.adjustHeight(height); - this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}}, duration, [onComplete, this.movedDelegate], easing, YAHOO.util.Motion); - } - }, - - /** - * Sets the element's position and size the the specified region. If animation is true then width, height, x and y will be animated concurrently. - * @param {YAHOO.util.Region} region The region to fill - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - setRegion : function(region, animate, duration, onComplete, easing){ - this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, animate, duration, onComplete, easing); - }, - - /** - * Appends an event handler to this element - * @param {String} eventName The type of event to listen for - * @param {Function} handler The method the event invokes - * @param {<i>Object</i>} scope (optional) An arbitrary object that will be - * passed as a parameter to the handler - * @param {<i>boolean</i>} override (optional) If true, the obj passed in becomes - * the execution scope of the listener - */ - addListener : function(eventName, handler, scope, override){ - YAHOO.util.Event.addListener(this.dom, eventName, handler, scope, override); - }, - - /** - * Appends an event handler to this element and automatically prevents the default action, and if set stops propagation (bubbling) as well - * @param {String} eventName The type of event to listen for - * @param {Boolean} stopPropagation Whether to also stopPropagation (bubbling) - * @param {Function} handler The method the event invokes - * @param {<i>Object</i>} scope (optional) An arbitrary object that will be - * passed as a parameter to the handler - * @param {<i>boolean</i>} override (optional) If true, the obj passed in becomes - * the execution scope of the listener - */ - addHandler : function(eventName, stopPropagation, handler, scope, override){ - var fn = YAHOO.ext.Element.createStopHandler(stopPropagation, handler, scope, override); - YAHOO.util.Event.addListener(this.dom, eventName, fn); - }, - - /** @private */ - - /** - * Appends an event handler to this element (Same as addListener) - * @param {String} eventName The type of event to listen for - * @param {Function} handler The method the event invokes - * @param {<i>Object</i>} scope (optional) An arbitrary object that will be - * passed as a parameter to the handler - * @param {<i>boolean</i>} override (optional) If true, the obj passed in becomes - * the execution scope of the listener - */ - on : function(eventName, handler, scope, override){ - YAHOO.util.Event.addListener(this.dom, eventName, handler, scope, override); - }, - - /** - * Append a managed listener - See {@link YAHOO.ext.EventObject} for more details. - * @param {String} eventName The type of event to listen for - * @param {Function} fn The method the event invokes - * @param {<i>Object</i>} scope (optional) An arbitrary object that will be - * passed as a parameter to the handler - * @param {<i>boolean</i>} override (optional) If true, the obj passed in becomes - * the execution scope of the listener - */ - addManagedListener : function(eventName, fn, scope, override){ - return YAHOO.ext.EventManager.on(this.dom, eventName, fn, scope, override); - }, - - /** - * Append a managed listener (shorthanded for {@link #addManagedListener}) - * @param {String} eventName The type of event to listen for - * @param {Function} fn The method the event invokes - * @param {<i>Object</i>} scope (optional) An arbitrary object that will be - * passed as a parameter to the handler - * @param {<i>boolean</i>} override (optional) If true, the obj passed in becomes - * the execution scope of the listener - */ - mon : function(eventName, fn, scope, override){ - return YAHOO.ext.EventManager.on(this.dom, eventName, fn, scope, override); - }, - /** - * Removes an event handler from this element - * @param {String} sType the type of event to remove - * @param {Function} fn the method the event invokes - */ - removeListener : function(eventName, handler){ - YAHOO.util.Event.removeListener(this.dom, eventName, handler); - }, - - /** - * Removes all previous added listeners from this element - */ - removeAllListeners : function(){ - YAHOO.util.Event.purgeElement(this.dom); - }, - - - /** - * Set the opacity of the element - * @param {Float} opacity The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc - * @param {<i>Boolean</i>} animate (optional) Animate (fade) the transition (Default is false) - * @param {<i>Float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut if height is larger or YAHOO.util.Easing.easeIn if it is smaller) - */ - setOpacity : function(opacity, animate, duration, onComplete, easing){ - if(!animate || !YAHOO.util.Anim){ - YAHOO.util.Dom.setStyle(this.dom, 'opacity', opacity); - }else{ - this.anim({opacity: {to: opacity}}, duration, onComplete, easing); - } - }, - - /** - * Same as getX() - */ - getLeft : function(){ - return this.getX(); - }, - - /** - * Gets the right X coordinate of the element (element X position + element width) - * @return {String} The left position of the element - */ - getRight : function(){ - return this.getX() + this.getWidth(); - }, - - /** - * Same as getY() - */ - getTop : function() { - return this.getY(); - }, - - /** - * Gets the bottom Y coordinate of the element (element Y position + element height) - * @return {String} The bottom position of the element - */ - getBottom : function(){ - return this.getY() + this.getHeight(); - }, - - /** - * Set the element as absolute positioned with the specified z-index - * @param {<i>Number</i>} zIndex (optional) - */ - setAbsolutePositioned : function(zIndex){ - this.setStyle('position', 'absolute'); - if(zIndex){ - this.setStyle('z-index', zIndex); - } - }, - - /** - * Set the element as relative positioned with the specified z-index - * @param {<i>Number</i>} zIndex (optional) - */ - setRelativePositioned : function(zIndex){ - this.setStyle('position', 'relative'); - if(zIndex){ - this.setStyle('z-index', zIndex); - } - //this.setStyle('left', 0); - //this.setStyle('top', 0); - }, - - /** - * Clear positioning back to the default when the document was loaded - */ - clearPositioning : function(){ - this.setStyle('position', ''); - this.setStyle('left', ''); - this.setStyle('right', ''); - this.setStyle('top', ''); - this.setStyle('bottom', ''); - }, - - /** - * Gets an object with all CSS positioning properties. Useful along with {@link #setPositioning} to get snapshot before performing an update and then restoring the element. - */ - getPositioning : function(){ - return { - 'position' : this.getStyle('position'), - 'left' : this.getStyle('left'), - 'right' : this.getStyle('right'), - 'top' : this.getStyle('top'), - 'bottom' : this.getStyle('bottom') - }; - }, - - /** - * Gets the width of the border(s) for the specified side(s) - * @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example, - * passing lr would get the border (l)eft width + the border (r)ight width. - * @return {Number} The width of the sides passed added together - */ - getBorderWidth : function(side){ - var width = 0; - var b = YAHOO.ext.Element.borders; - for(var s in b){ - if(typeof b[s] != 'function'){ - if(side.indexOf(s) !== -1){ - var w = parseInt(this.getStyle(b[s]), 10); - if(!isNaN(w)) width += w; - } - } - } - return width; - }, - - /** - * Gets the width of the padding(s) for the specified side(s) - * @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example, - * passing lr would get the padding (l)eft + the padding (r)ight. - * @return {Number} The padding of the sides passed added together - */ - getPadding : function(side){ - var pad = 0; - var b = YAHOO.ext.Element.paddings; - for(var s in b){ - if(typeof s[b] != 'function'){ - if(side.indexOf(s) !== -1){ - var w = parseInt(this.getStyle(b[s]), 10); - if(!isNaN(w)) pad += w; - } - } - } - return pad; - }, - - /** - * Set positioning with an object returned by {@link #getPositioning}. - */ - setPositioning : function(positionCfg){ - this.setStyle('position', positionCfg.position); - this.setStyle('left', positionCfg.left); - this.setStyle('right', positionCfg.right); - this.setStyle('top', positionCfg.top); - this.setStyle('bottom', positionCfg.bottom); - }, - - /** - * Move this element relative to it's current position. - * @param {String} direction Possible values are: 'left', 'right', 'up', 'down'. - * @param {Number} distance How far to move the element in pixels - * @param {<i>Boolean</i>} animate (optional) Animate the movement (Default is false) - * @param {<i>Float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. - */ - move : function(direction, distance, animate, duration, onComplete, easing){ - var xy = this.getXY(); - direction = direction.toLowerCase(); - switch(direction){ - case 'left': - this.moveTo(xy[0]-distance, xy[1], animate, duration, onComplete, easing); - return; - case 'right': - this.moveTo(xy[0]+distance, xy[1], animate, duration, onComplete, easing); - return; - case 'up': - this.moveTo(xy[0], xy[1]-distance, animate, duration, onComplete, easing); - return; - case 'down': - this.moveTo(xy[0], xy[1]+distance, animate, duration, onComplete, easing); - return; - } - }, - - /** - * Clip overflow on the element - use {@link #unclip} to remove - */ - clip : function(){ - this.setStyle('overflow', 'hidden'); - }, - - /** - * Return clipping (overflow) to original clipping when the document loaded - */ - unclip : function(){ - this.setStyle('overflow', this.originalClip); - }, - - /** - * Align this element with another element. - * @param {String/HTMLElement/YAHOO.ext.Element} element The element to align to. - * @param {String} position The position to align to. Possible values are 'tl' - top left, 'tr' - top right, 'bl' - bottom left, and 'br' - bottom right. - * @param {<i>Array</i>} offsets (optional) Offset the positioning by [x, y] - * @param {<i>Boolean</i>} animate (optional) Animate the movement (Default is false) - * @param {<i>Float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. - */ - alignTo : function(element, position, offsets, animate, duration, onComplete, easing){ - var otherEl = getEl(element); - if(!otherEl){ - return; // must not exist - } - offsets = offsets || [0, 0]; - var r = otherEl.getRegion(); - position = position.toLowerCase(); - switch(position){ - case 'bl': - this.moveTo(r.left + offsets[0], r.bottom + offsets[1], - animate, duration, onComplete, easing); - return; - case 'br': - this.moveTo(r.right + offsets[0], r.bottom + offsets[1], - animate, duration, onComplete, easing); - return; - case 'tl': - this.moveTo(r.left + offsets[0], r.top + offsets[1], - animate, duration, onComplete, easing); - return; - case 'tr': - this.moveTo(r.right + offsets[0], r.top + offsets[1], - animate, duration, onComplete, easing); - return; - } - }, - - /** - * Clears any opacity settings from this element. Required in some cases for IE. - */ - clearOpacity : function(){ - if (window.ActiveXObject) { - this.dom.style.filter = ''; - } else { - this.dom.style.opacity = ''; - this.dom.style['-moz-opacity'] = ''; - this.dom.style['-khtml-opacity'] = ''; - } - }, - - /** - * Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}. - * @param {<i>Boolean</i>} animate (optional) Animate (fade) the transition (Default is false) - * @param {<i>Float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - hide : function(animate, duration, onComplete, easing){ - this.setVisible(false, animate, duration, onComplete, easing); - }, - - /** - * Show this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}. - * @param {<i>Boolean</i>} animate (optional) Animate (fade in) the transition (Default is false) - * @param {<i>Float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - show : function(animate, duration, onComplete, easing){ - this.setVisible(true, animate, duration, onComplete, easing); - }, - - /** - * @private Test if size has a unit, otherwise appends the default - */ - addUnits : function(size){ - if(typeof size == 'number' || !YAHOO.ext.Element.unitPattern.test(size)){ - return size + this.defaultUnit; - } - return size; - }, - - beginMeasure : function(){ - var p = this.dom; - if(p.offsetWidth || p.offsetHeight){ - return; // offsets work already - } - var changed = []; - var p = this.dom; // start with this element - while(p && p.tagName.toLowerCase() != 'body'){ - if(YAHOO.util.Dom.getStyle(p, 'display') == 'none'){ - changed.push({el: p, visibility: YAHOO.util.Dom.getStyle(p, 'visibility')}); - p.style.visibility = 'hidden'; - p.style.display = 'block'; - } - p = p.parentNode; - } - this._measureChanged = changed; - }, - - endMeasure : function(){ - var changed = this._measureChanged; - if(changed){ - for(var i = 0, len = changed.length; i < len; i++) { - var r = changed[i]; - r.el.style.visibility = r.visibility; - r.el.style.display = 'none'; - } - this._measureChanged = null; - } - }, - /** - * Update the innerHTML of this element, optionally searching for and processing scripts - * @param {String} html The new HTML - * @param {<i>Boolean</i>} loadScripts (optional) true to look for and process scripts - */ - update : function(html, loadScripts){ - this.dom.innerHTML = html; - if(!loadScripts) return; - - var dom = this.dom; - var _parseScripts = function(){ - var s = this.dom.getElementsByTagName("script"); - var docHead = document.getElementsByTagName("head")[0]; - - // For browsers which discard scripts when inserting innerHTML, extract the scripts using a RegExp - if(s.length == 0){ - var re = /(?:<script.*(?:src=[\"\'](.*)[\"\']).*>.*<\/script>)|(?:<script.*>([\S\s]*?)<\/script>)/ig; // assumes HTML well formed and then loop through it. - var match; - while(match = re.exec(html)){ - var s0 = document.createElement("script"); - if (match[1]) - s0.src = match[1]; - else if (match[2]) - s0.text = match[2]; - else - continue; - docHead.appendChild(s0); - } - }else { - for(var i = 0; i < s.length; i++){ - var s0 = document.createElement("script"); - s0.type = s[i].type; - if (s[i].text) { - s0.text = s[i].text; - } else { - s0.src = s[i].src; - } - docHead.appendChild(s0); - } - } - } - // set timeout to give DOM opportunity to catch up - setTimeout(_parseScripts, 10); - }, - - /** - * Gets this elements UpdateManager - * @return The UpdateManager - * @type YAHOO.ext.UpdateManager - */ - getUpdateManager : function(){ - if(!this.updateManager){ - this.updateManager = new YAHOO.ext.UpdateManager(this); - } - return this.updateManager; - }, - - /** - * Calculates the x, y to center this element on the screen - * @return {Array} The x, y values [x, y] - */ - getCenterXY : function(offsetScroll){ - var centerX = Math.round((YAHOO.util.Dom.getViewportWidth()-this.getWidth())/2); - var centerY = Math.round((YAHOO.util.Dom.getViewportHeight()-this.getHeight())/2); - if(!offsetScroll){ - return [centerX, centerY]; - }else{ - var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft || 0; - var scrollY = document.documentElement.scrollTop || document.body.scrollTop || 0; - return[centerX + scrollX, centerY + scrollY]; - } - }, - /** - * Gets an array of child YAHOO.ext.Element objects by tag name - * @param {String} tagName - * @return {Array} The children - */ - getChildrenByTagName : function(tagName){ - var children = this.dom.getElementsByTagName(tagName); - var len = children.length; - var ce = [len]; - for(var i = 0; i < len; ++i){ - ce[i] = YAHOO.ext.Element.get(children[i], true); - } - return ce; - }, - - /** - * Gets an array of child YAHOO.ext.Element objects by class name and optional tagName - * @param {String} className - * @param {<i>String</i>} tagName (optional) - * @return {Array} The children - */ - getChildrenByClassName : function(className, tagName){ - var children = YAHOO.util.Dom.getElementsByClassName(className, tagName, this.dom); - var len = children.length; - var ce = [len]; - for(var i = 0; i < len; ++i){ - ce[i] = YAHOO.ext.Element.get(children[i], true); - } - return ce; - }, - - /** - * Tests various css rules/browsers to determine if this element uses a border box - */ - isBorderBox : function(){ - var el = this.dom; - var b = YAHOO.ext.util.Browser; - var strict = YAHOO.ext.Strict; - return((b.isIE && !b.isIE7) || (b.isIE7 && !strict && el.style.boxSizing != 'content-box') || - (b.isGecko && YAHOO.util.Dom.getStyle(el, "-moz-box-sizing") == 'border-box') || - (!b.isSafari && YAHOO.util.Dom.getStyle(el, "box-sizing") == 'border-box')); - }, - - /** - * Return a box {x, y, width, height} that can be used to set another elements - * size to match this element. If contentBox is true, a box for the content - * of the element is returned. - */ - getBox : function(contentBox){ - var xy = this.getXY(); - var el = this.dom; - var w = el.offsetWidth; - var h = el.offsetHeight; - if(!contentBox){ - return {x: xy[0], y: xy[1], width: w, height: h}; - }else{ - var l = this.getBorderWidth('l')+this.getPadding('l'); - var r = this.getBorderWidth('r')+this.getPadding('r'); - var t = this.getBorderWidth('t')+this.getPadding('t'); - var b = this.getBorderWidth('b')+this.getPadding('b'); - return {x: xy[0]+l, y: xy[1]+t, width: w-(l+r), height: h-(t+b)}; - } - }, - - /** - * Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently. - * @param {Object} box The box to fill {x, y, width, height} - * @param {<i>Boolean</i>} adjust (optional) Whether to adjust for box-model issues automatically - * @param {<i>Boolean</i>} animate (optional) Animate the transition (Default is false) - * @param {<i>float</i>} duration (optional) How long the animation lasts. (Defaults to .35 seconds) - * @param {<i>Function</i>} onComplete (optional) Function to call when animation completes. - * @param {<i>Function</i>} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeBoth) - */ - setBox : function(box, adjust, animate, duration, onComplete, easing){ - var w = box.width, h = box.height; - if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){ - w -= (this.getBorderWidth('lr') + this.getPadding('lr')); - h -= (this.getBorderWidth('tb') + this.getPadding('tb')); - } - this.setBounds(box.x, box.y, w, h, animate, duration, onComplete, easing); - } -}; - -/** - * Whether to automatically adjust width and height settings for box-model issues - */ -YAHOO.ext.Element.prototype.autoBoxAdjust = true; - -/** - * @private Used to check if a value has a unit - */ -YAHOO.ext.Element.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i; -/** - * Visibility mode constant - Use visibility to hide element - * @type Number - */ -YAHOO.ext.Element.VISIBILITY = 1; -/** - * Visibility mode constant - Use display to hide element - * @type Number - */ -YAHOO.ext.Element.DISPLAY = 2; - -/** @ignore */ -YAHOO.ext.Element.borders = {l: 'border-left-width', r: 'border-right-width', t: 'border-top-width', b: 'border-bottom-width'}; -/** @ignore */ -YAHOO.ext.Element.paddings = {l: 'padding-left', r: 'padding-right', t: 'padding-top', b: 'padding-bottom'}; - -/** - * @private Call out to here so we make minimal closure - */ -YAHOO.ext.Element.createStopHandler = function(stopPropagation, handler, scope, override){ - return function(e){ - if(e){ - if(stopPropagation){ - YAHOO.util.Event.stopEvent(e); - }else { - YAHOO.util.Event.preventDefault(e); - } - } - handler.call(override && scope ? scope : window, e, scope); - }; -}; - -/** - * @private - */ -YAHOO.ext.Element.cache = {}; - -/** - * Static method to retreive Element objects. Uses simple caching to consistently return the same object. - * Automatically fixes if an object was recreated with the same id via AJAX or DOM. - * @param {String/HTMLElement/Element} el The id of the element or the element to wrap (must have an id). If you pass in an element, it is returned - * @param {<i>Boolean</i>} autoGenerateId (optional) Set this flag to true if you are passing an element without an id (like document.body). It will auto generate an id if one isn't present. - * @return {Element} The element object - */ -YAHOO.ext.Element.get = function(el, autoGenerateId){ - if(!el){ return null; } - if(el instanceof YAHOO.ext.Element){ - el.dom = YAHOO.util.Dom.get(el.id); // refresh dom element in case no longer valid - YAHOO.ext.Element.cache[el.id] = el; // in case it was created directly with Element(), let's cache it - return el; - } - var key = el; - if(typeof el != 'string'){ // must be an element - if(!el.id && !autoGenerateId){ return null; } - YAHOO.util.Dom.generateId(el, 'elgen-'); - key = el.id; - } - var element = YAHOO.ext.Element.cache[key]; - if(!element){ - element = new YAHOO.ext.Element(key); - YAHOO.ext.Element.cache[key] = element; - }else{ - element.dom = YAHOO.util.Dom.get(key); - } - return element; -}; - -/** - * Shorthand function for YAHOO.ext.Element.get() - */ -var getEl = YAHOO.ext.Element.get; - -// clean up refs -YAHOO.util.Event.addListener(window, 'unload', function(){ YAHOO.ext.Element.cache = null; });-
- - - -
- - - - - - - - --/** - * @class - * Registers event handlers that want to receive an EventObject instead of the standard browser event - * See {@link YAHOO.ext.EventObject} for more details on the usage of this object. - */ -YAHOO.ext.EventManager = new function(){ - var docReadyEvent; - var docReadyProcId; - var docReadyState = false; - - this.ieDeferSrc = "javascript:false"; - - var fireDocReady = function(){ - if(!docReadyState){ - docReadyState = true; - if(docReadyProcId){ - clearInterval(docReadyProcId); - } - if(docReadyEvent){ - docReadyEvent.fire(); - } - } - }; - - var initDocReady = function(){ - docReadyEvent = new YAHOO.util.CustomEvent('documentready'); - if(document.addEventListener) { - YAHOO.util.Event.on(document, "DOMContentLoaded", fireDocReady); - }else if(YAHOO.ext.util.Browser.isIE){ - // inspired by http://www.thefutureoftheweb.com/blog/2006/6/adddomloadevent - document.write('<s'+'cript id="ie-deferred-loader" defer="defer" src="' + - YAHOO.ext.EventManager.ieDeferSrc + '"></s'+'cript>'); - YAHOO.util.Event.on('ie-deferred-loader', 'readystatechange', function(){ - if(this.readyState == 'complete'){ - fireDocReady(); - } - }); - }else if(YAHOO.ext.util.Browser.isSafari){ - docReadyProcId = setInterval(function(){ - var rs = document.readyState; - if(rs == 'loaded' || rs == 'complete') { - fireDocReady(); - } - }, 10); - } - // no matter what, make sure it fires on load - YAHOO.util.Event.on(window, 'load', fireDocReady); - }; - /** - * Places a simple wrapper around an event handler to override the browser event - * object with a YAHOO.ext.EventObject - */ - this.wrap = function(fn, scope, override){ - var wrappedFn = function(e){ - YAHOO.ext.EventObject.setEvent(e); - fn.call(override ? scope || window : window, YAHOO.ext.EventObject, scope); - }; - return wrappedFn; - }; - - /** - * Appends an event handler - * - * @param {Object} element The html element to assign the - * event to - * @param {String} eventName The type of event to append - * @param {Function} fn The method the event invokes - * @param {Object} scope An arbitrary object that will be - * passed as a parameter to the handler - * @param {boolean} override If true, the obj passed in becomes - * the execution scope of the listener - * @return {Function} The wrapper function created (to be used to remove the listener if necessary) - */ - this.addListener = function(element, eventName, fn, scope, override){ - var wrappedFn = this.wrap(fn, scope, override); - YAHOO.util.Event.addListener(element, eventName, wrappedFn); - return wrappedFn; - }; - - /** - * Removes an event handler - * - * @param {Object} element The html element to remove the - * event from - * @param {String} eventName The type of event to append - * @param {Function} wrappedFn The wrapper method returned when adding the listener - * @return {Boolean} True if a listener was actually removed - */ - this.removeListener = function(element, eventName, wrappedFn){ - return YAHOO.util.Event.removeListener(element, eventName, wrappedFn); - }; - - /** - * Appends an event handler (shorthand for addListener) - * - * @param {Object} element The html element to assign the - * event to - * @param {String} eventName The type of event to append - * @param {Function} fn The method the event invokes - * @param {Object} scope An arbitrary object that will be - * passed as a parameter to the handler - * @param {boolean} override If true, the obj passed in becomes - * the execution scope of the listener - * @return {Function} The wrapper function created (to be used to remove the listener if necessary) - */ - this.on = function(element, eventName, fn, scope, override){ - var wrappedFn = this.wrap(fn, scope, override); - YAHOO.util.Event.addListener(element, eventName, wrappedFn); - return wrappedFn; - }; - - /** - * Fires when the document is ready (before onload) - */ - this.onDocumentReady = function(fn, scope, override){ - if(!docReadyEvent){ - initDocReady(); - } - docReadyEvent.subscribe(fn, scope, override); - } -}; - -/** - * @class - * EventObject exposes the Yahoo! UI Event functionality directly on the object - * passed to your event handler. It exists mostly for convenience. It also fixes the annoying null checks automatically to cleanup your code - * (All the YAHOO.util.Event methods throw javascript errors if the passed event is null). - * To get an EventObject instead of the standard browser event, - * your must register your listener thru the {@link YAHOO.ext.EventManager} or directly on an Element - * with {@link YAHOO.ext.Element#addManagedListener} or the shorthanded equivalent {@link YAHOO.ext.Element#mon}.<br> - * Example: - * <pre><code> - fu<>nction handleClick(e){ // e is not a standard event object, it is a YAHOO.ext.EventObject - e.preventDefault(); - var target = e.getTarget(); - ... - } - var myDiv = getEl('myDiv'); - myDiv.mon('click', handleClick); - //or - YAHOO.ext.EventManager.on('myDiv', 'click', handleClick); - YAHOO.ext.EventManager.addListener('myDiv', 'click', handleClick); - </code></pre> - */ -YAHOO.ext.EventObject = new function(){ - /** The normal browser event */ - this.browserEvent = null; - /** The button pressed in a mouse event */ - this.button = -1; - /** True if the shift key was down during the event */ - this.shiftKey = false; - /** True if the control key was down during the event */ - this.ctrlKey = false; - /** True if the alt key was down during the event */ - this.altKey = false; - - /** Key constant @type Number */ - this.BACKSPACE = 8; - /** Key constant @type Number */ - this.TAB = 9; - /** Key constant @type Number */ - this.RETURN = 13; - /** Key constant @type Number */ - this.ESC = 27; - /** Key constant @type Number */ - this.SPACE = 32; - /** Key constant @type Number */ - this.PAGEUP = 33; - /** Key constant @type Number */ - this.PAGEDOWN = 34; - /** Key constant @type Number */ - this.END = 35; - /** Key constant @type Number */ - this.HOME = 36; - /** Key constant @type Number */ - this.LEFT = 37; - /** Key constant @type Number */ - this.UP = 38; - /** Key constant @type Number */ - this.RIGHT = 39; - /** Key constant @type Number */ - this.DOWN = 40; - /** Key constant @type Number */ - this.DELETE = 46; - /** Key constant @type Number */ - this.F5 = 116; - - /** @private */ - this.setEvent = function(e){ - this.browserEvent = e; - if(e){ - this.button = e.button; - this.shiftKey = e.shiftKey; - this.ctrlKey = e.ctrlKey; - this.altKey = e.altKey; - }else{ - this.button = -1; - this.shiftKey = false; - this.ctrlKey = false; - this.altKey = false; - } - }; - - /** - * Stop the event. Calls YAHOO.util.Event.stopEvent() if the event is not null. - */ - this.stopEvent = function(){ - if(this.browserEvent){ - YAHOO.util.Event.stopEvent(this.browserEvent); - } - }; - - /** - * Prevents the browsers default handling of the event. Calls YAHOO.util.Event.preventDefault() if the event is not null. - */ - this.preventDefault = function(){ - if(this.browserEvent){ - YAHOO.util.Event.preventDefault(this.browserEvent); - } - }; - - /** @private */ - this.isNavKeyPress = function(){ - return (this.browserEvent.keyCode && this.browserEvent.keyCode >= 33 && this.browserEvent.keyCode <= 40); - }; - - /** - * Cancels bubbling of the event. Calls YAHOO.util.Event.stopPropagation() if the event is not null. - */ - this.stopPropagation = function(){ - if(this.browserEvent){ - YAHOO.util.Event.stopPropagation(this.browserEvent); - } - }; - - /** - * Gets the key code for the event. Returns value from YAHOO.util.Event.getCharCode() if the event is not null. - * @return {Number} - */ - this.getCharCode = function(){ - if(this.browserEvent){ - return YAHOO.util.Event.getCharCode(this.browserEvent); - } - return null; - }; - - /** - * Gets the x coordinate of the event. Returns value from YAHOO.util.Event.getPageX() if the event is not null. - * @return {Number} - */ - this.getPageX = function(){ - if(this.browserEvent){ - return YAHOO.util.Event.getPageX(this.browserEvent); - } - return null; - }; - - /** - * Gets the y coordinate of the event. Returns value from YAHOO.util.Event.getPageY() if the event is not null. - * @return {Number} - */ - this.getPageY = function(){ - if(this.browserEvent){ - return YAHOO.util.Event.getPageY(this.browserEvent); - } - return null; - }; - - /** - * Gets the time of the event. Returns value from YAHOO.util.Event.getTime() if the event is not null. - * @return {Number} - */ - this.getTime = function(){ - if(this.browserEvent){ - return YAHOO.util.Event.getTime(this.browserEvent); - } - return null; - }; - - /** - * Gets the page coordinates of the event. Returns value from YAHOO.util.Event.getXY() if the event is not null. - * @return {Array} The xy values like [x, y] - */ - this.getXY = function(){ - if(this.browserEvent){ - return YAHOO.util.Event.getXY(this.browserEvent); - } - return []; - }; - - /** - * Gets the target for the event. Returns value from YAHOO.util.Event.getTarget() if the event is not null. - * @return {HTMLelement} - */ - this.getTarget = function(){ - if(this.browserEvent){ - return YAHOO.util.Event.getTarget(this.browserEvent); - } - return null; - }; - - /** - * Walk up the DOM looking for a particular target - if the default target matches, it is returned. - * @return {HTMLelement} - */ - this.findTarget = function(className, tagName){ - if(tagName) tagName = tagName.toLowerCase(); - if(this.browserEvent){ - function isMatch(el){ - if(!el){ - return false; - } - if(className && !YAHOO.util.Dom.hasClass(el, className)){ - return false; - } - if(tagName && el.tagName.toLowerCase() != tagName){ - return false; - } - return true; - }; - - var t = this.getTarget(); - if(!t || isMatch(t)){ - return t; - } - var p = t.parentNode; - while(p && p.tagName.toUpperCase() != 'BODY'){ - if(isMatch(p)){ - return p; - } - p = p.parentNode; - } - } - return null; - }; - /** - * Gets the related target. Returns value from YAHOO.util.Event.getRelatedTarget() if the event is not null. - * @return {HTMLelement} - */ - this.getRelatedTarget = function(){ - if(this.browserEvent){ - return YAHOO.util.Event.getRelatedTarget(this.browserEvent); - } - return null; - }; - - /** - * Normalizes mouse wheel delta across browsers - */ - this.getWheelDelta = function(){ - var e = this.browserEvent; - var delta = 0; - if(e.wheelDelta){ /* IE/Opera. */ - delta = e.wheelDelta/120; - /** In Opera 9, delta differs in sign as compared to IE. */ - if(window.opera) delta = -delta; - }else if(e.detail){ /** Mozilla case. */ - delta = -e.detail/3; - } - return delta; - }; - - /** - * Returns true if the control, shift or alt key was pressed during this event. - * @return {Boolean} - */ - this.hasModifier = function(){ - return this.ctrlKey || this.altKey || this.shiftKey; - }; -}(); - --
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.Grid | -This class represents the primary interface of a component based grid control. | -
YAHOO.namespace('ext.grid'); - -/** - * @class - * This class represents the primary interface of a component based grid control. - * <br><br>Usage:<pre><code> - * var grid = new YAHOO.ext.grid.Grid('my-container-id', dataModel, columnModel); - * // set any options - * grid.render(); - * </code></pre> - * @requires YAHOO.util.Dom - * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent - * @requires YAHOO.ext.Element - * @requires YAHOO.ext.util.Browser - * @requires YAHOO.ext.util.CSS - * @requires YAHOO.ext.SplitBar - * @requires YAHOO.ext.EventObject - * @constructor - * @param {String/HTMLElement/YAHOO.ext.Element} container The element into which this grid will be rendered - - * The container MUST have some type of size defined for the grid to fill. The container will be - * automatically set to position relative if it isn't already. - * @param {Object} dataModel The data model to bind to - * @param {Object} colModel The column model with info about this grid's columns - * @param {<i>Object</i>} selectionModel (optional) The selection model for this grid (defaults to DefaultSelectionModel) - */ -YAHOO.ext.grid.Grid = function(container, dataModel, colModel, selectionModel){ - /** @private */ - this.container = YAHOO.ext.Element.get(container); - if(this.container.getStyle('position') != 'absolute'){ - this.container.setStyle('position', 'relative'); - } - /** @private */ - this.id = this.container.id; - - /** @private */ - this.rows = []; - /** @private */ - this.rowCount = 0; - /** @private */ - this.fieldId = null; - /** @private */ - this.dataModel = dataModel; - /** @private */ - this.colModel = colModel; - /** @private */ - this.selModel = selectionModel; - - /** @private */ - this.activeEditor = null; - - /** @private */ - this.editingCell = null; - - /** The minimum width a column can be resized to. (Defaults to 25) - * @type Number */ - this.minColumnWidth = 25; - - /** True to automatically resize the columns to fit their content <b>on initial render</b> - * @type Boolean */ - this.autoSizeColumns = false; - - /** True to measure headers with column data when auto sizing columns - * @type Boolean */ - this.autoSizeHeaders = false; - - - /** If autoSizeColumns is on, maxRowsToMeasure can be used to limit the number of - * rows measured to get a columns size - defaults to 0 (all rows). - * @type Number */ - this.maxRowsToMeasure = 0; - - /** True to highlight rows when the mouse is over (default is false) - * @type Boolean */ - this.trackMouseOver = false; - - /** True to enable drag and drop of rows - * @type Boolean */ - this.enableDragDrop = false; - - /** True to stripe the rows (default is true) - * @type Boolean */ - this.stripeRows = true; - - /** A regular expression defining tagNames - * allowed to have text selection (Defaults to <code>/INPUT|TEXTAREA/i</code>) */ - this.allowTextSelectionPattern = /INPUT|TEXTAREA|SELECT/i; - - /** @private */ - this.setValueDelegate = this.setCellValue.createDelegate(this); - - var CE = YAHOO.util.CustomEvent; - /** @private */ - this.events = { - // raw events - 'click' : new CE('click'), - 'dblclick' : new CE('dblclick'), - 'mousedown' : new CE('mousedown'), - 'mouseup' : new CE('mouseup'), - 'mouseover' : new CE('mouseover'), - 'mouseout' : new CE('mouseout'), - 'keypress' : new CE('keypress'), - 'keydown' : new CE('keydown'), - // custom events - 'cellclick' : new CE('cellclick'), - 'celldblclick' : new CE('celldblclick'), - 'rowclick' : new CE('rowclick'), - 'rowdblclick' : new CE('rowdblclick'), - 'headerclick' : new CE('headerclick'), - 'rowcontextmenu' : new CE('rowcontextmenu'), - 'headercontextmenu' : new CE('headercontextmenu'), - 'beforeedit' : new CE('beforeedit'), - 'afteredit' : new CE('afteredit'), - 'bodyscroll' : new CE('bodyscroll'), - 'columnresize' : new CE('columnresize'), - 'startdrag' : new CE('startdrag'), - 'enddrag' : new CE('enddrag'), - 'dragdrop' : new CE('dragdrop'), - 'dragover' : new CE('dragover'), - 'dragenter' : new CE('dragenter'), - 'dragout' : new CE('dragout') - }; -}; - -YAHOO.ext.grid.Grid.prototype = { - /** - * Called once after all setup has been completed and the grid is ready to be rendered. - */ - render : function(){ - if(!this.view){ - if(this.dataModel.isPaged()){ - this.view = new YAHOO.ext.grid.PagedGridView(); - }else{ - this.view = new YAHOO.ext.grid.GridView(); - } - } - this.view.init(this); - this.el = getEl(this.view.render(), true); - var c = this.container; - c.mon("click", this.onClick, this, true); - c.mon("dblclick", this.onDblClick, this, true); - c.mon("contextmenu", this.onContextMenu, this, true); - c.mon("selectstart", this.cancelTextSelection, this, true); - c.mon("mousedown", this.cancelTextSelection, this, true); - c.mon("mousedown", this.onMouseDown, this, true); - c.mon("mouseup", this.onMouseUp, this, true); - if(this.trackMouseOver){ - this.el.mon("mouseover", this.onMouseOver, this, true); - this.el.mon("mouseout", this.onMouseOut, this, true); - } - c.mon("keypress", this.onKeyPress, this, true); - c.mon("keydown", this.onKeyDown, this, true); - this.init(); - }, - - /** @private */ - init : function(){ - this.rows = this.el.dom.rows; - if(!this.disableSelection){ - if(!this.selModel){ - this.selModel = new YAHOO.ext.grid.DefaultSelectionModel(this); - } - this.selModel.init(this); - this.selModel.onSelectionChange.subscribe(this.updateField, this, true); - }else{ - this.selModel = new YAHOO.ext.grid.DisableSelectionModel(this); - this.selModel.init(this); - } - - if(this.enableDragDrop){ - this.dd = new YAHOO.ext.grid.GridDD(this, this.container.dom); - } - }, - - /** @ignore */ - onMouseDown : function(e){ - this.fireEvent('mousedown', e); - }, - - /** @ignore */ - onMouseUp : function(e){ - this.fireEvent('mouseup', e); - }, - - /** @ignore */ - onMouseOver : function(e){ - this.fireEvent('mouseover', e); - }, - - /** @ignore */ - onMouseOut : function(e){ - this.fireEvent('mouseout', e); - }, - - /** @ignore */ - onKeyPress : function(e){ - this.fireEvent('keypress', e); - }, - - /** @ignore */ - onKeyDown : function(e){ - this.fireEvent('keydown', e); - }, - - /** - * @private internal event firing - * expects arguments[0] is the event name and the rest are the fireDirect arguments - */ - fireEvent : function(){ - var ce = this.events[arguments[0].toLowerCase()]; - ce.fireDirect.apply(ce, Array.prototype.slice.call(arguments, 1)); - }, - /** - * Adds a listener for one of the many defined grid events - * @param {String} eventName The type of event to listen for - * @param {Function} fn The method the event invokes - * @param {<i>Object</i>} scope (optional) An arbitrary object that will be - * passed as a parameter to the handler - * @param {<i>boolean</i>} override (optional) If true, the obj passed in becomes - * the execution scope of the listener - */ - addListener : function(eventName, fn, scope, override){ - this.events[eventName.toLowerCase()].subscribe(fn, scope, override); - }, - - /** - * Shorthand for addListener - */ - on : function(eventName, fn, scope, override){ - this.events[eventName.toLowerCase()].subscribe(fn, scope, override); - }, - - removeListener : function(eventName, fn, scope){ - this.events[eventName.toLowerCase()].unsubscribe(fn, scope); - }, - - /** @ignore */ - onClick : function(e){ - this.fireEvent('click', e); - var target = e.getTarget(); - var row = this.getRowFromChild(target); - var cell = this.getCellFromChild(target); - var header = this.getHeaderFromChild(target); - if(row){ - this.fireEvent('rowclick', this, row.rowIndex, e); - } - if(cell){ - this.fireEvent('cellclick', this, row.rowIndex, cell.columnIndex, e); - } - if(header){ - this.fireEvent('headerclick', this, header.columnIndex, e); - } - }, - - /** @ignore */ - onContextMenu : function(e){ - var target = e.getTarget(); - var row = this.getRowFromChild(target); - var header = this.getHeaderFromChild(target); - if(row){ - this.fireEvent('rowcontextmenu', this, row.rowIndex, e); - } - if(header){ - this.fireEvent('headercontextmenu', this, header.columnIndex, e); - } - e.preventDefault(); - }, - - /** @ignore */ - onDblClick : function(e){ - this.fireEvent('dblclick', e); - var target = e.getTarget(); - var row = this.getRowFromChild(target); - var cell = this.getCellFromChild(target); - if(row){ - this.fireEvent('rowdblclick', this, row.rowIndex, e); - } - if(cell){ - this.fireEvent('celldblclick', this, row.rowIndex, cell.columnIndex, e); - } - }, - - /** - * Starts editing the specified for the specified row/column - */ - startEditing : function(rowIndex, colIndex){ - var row = this.rows[rowIndex]; - var cell = row.childNodes[colIndex]; - this.stopEditing(); - setTimeout(this.doEdit.createDelegate(this, [row, cell]), 10); - }, - - /** - * Stops any active editing - */ - stopEditing : function(){ - if(this.activeEditor){ - this.activeEditor.stopEditing(); - } - }, - - /** @ignore */ - doEdit : function(row, cell){ - if(!row || !cell) return; - var cm = this.colModel; - var dm = this.dataModel; - var colIndex = cell.columnIndex; - var rowIndex = row.rowIndex; - if(cm.isCellEditable(colIndex, rowIndex)){ - var ed = cm.getCellEditor(colIndex, rowIndex); - if(ed){ - if(this.activeEditor){ - this.activeEditor.stopEditing(); - } - this.fireEvent('beforeedit', this, rowIndex, colIndex); - this.activeEditor = ed; - this.editingCell = cell; - this.view.ensureVisible(row, true); - try{ - cell.focus(); - }catch(e){} - ed.init(this, this.el.dom.parentNode, this.setValueDelegate); - var value = dm.getValueAt(rowIndex, cm.getDataIndex(colIndex)); - // set timeout so firefox stops editing before starting a new edit - setTimeout(ed.startEditing.createDelegate(ed, [value, row, cell]), 1); - } - } - }, - - setCellValue : function(value, rowIndex, colIndex){ - this.dataModel.setValueAt(value, rowIndex, this.colModel.getDataIndex(colIndex)); - this.fireEvent('afteredit', this, rowIndex, colIndex); - }, - - /** @ignore Called when text selection starts or mousedown to prevent default */ - cancelTextSelection : function(e){ - var target = e.getTarget(); - if(target && target != this.el.dom.parentNode && !this.allowTextSelectionPattern.test(target.tagName)){ - e.preventDefault(); - } - }, - - /** - * Causes the grid to manually recalculate it's dimensions. Generally this is done automatically, - * but if manual update is required this method will initiate it. - */ - autoSize : function(){ - this.view.updateWrapHeight(); - this.view.adjustForScroll(); - }, - - /** - * Scrolls the grid to the specified row - * @param {Number/HTMLElement} row The row object or index of the row - */ - scrollTo : function(row){ - if(typeof row == 'number'){ - row = this.rows[row]; - } - this.view.ensureVisible(row, true); - }, - - /** @private */ - getEditingCell : function(){ - return this.editingCell; - }, - - /** - * Binds this grid to the field with the specified id. Initially reads and parses the comma - * delimited ids in the field and selects those items. All selections made in the grid - * will be persisted to the field by their ids comma delimited. - * @param {String} The id of the field to bind to - */ - bindToField : function(fieldId){ - this.fieldId = fieldId; - this.readField(); - }, - - /** @private */ - updateField : function(){ - if(this.fieldId){ - var field = YAHOO.util.Dom.get(this.fieldId); - field.value = this.getSelectedRowIds().join(','); - } - }, - - /** - * Causes the grid to read and select the ids from the bound field - See {@link #bindToField}. - */ - readField : function(){ - if(this.fieldId){ - var field = YAHOO.util.Dom.get(this.fieldId); - var values = field.value.split(','); - var rows = this.getRowsById(values); - this.selModel.selectRows(rows, false); - } - }, - - /** - * Returns the table row at the specified index - * @return {HTMLElement} - */ - getRow : function(index){ - return this.rows[index]; - }, - - /** - * Returns the rows that have the specified id(s). The id value for a row is provided - * by the DataModel. See {@link YAHOO.ext.grid.DefaultDataModel#getRowId}. - * @param {String/Array} An id to find or an array of ids - * @return {HtmlElement/Array} If one id was passed in, it returns one result. - * If an array of ids was specified, it returns an Array of HTMLElements - */ - getRowsById : function(id){ - var dm = this.dataModel; - if(!(id instanceof Array)){ - for(var i = 0; i < this.rows.length; i++){ - if(dm.getRowId(i) == id){ - return this.rows[i]; - } - } - return null; - } - var found = []; - var re = "^(?:"; - for(var i = 0; i < id.length; i++){ - re += id[i]; - if(i != id.length-1) re += "|"; - } - var regex = new RegExp(re + ")$"); - for(var i = 0; i < this.rows.length; i++){ - if(regex.test(dm.getRowId(i))){ - found.push(this.rows[i]); - } - } - return found; - }, - - /** - * Returns the row that comes after the specified row - text nodes are skipped. - * @param {HTMLElement} row - * @return {HTMLElement} - */ - getRowAfter : function(row){ - return this.getSibling('next', row); - }, - - /** - * Returns the row that comes before the specified row - text nodes are skipped. - * @param {HTMLElement} row - * @return {HTMLElement} - */ - getRowBefore : function(row){ - return this.getSibling('previous', row); - }, - - /** - * Returns the cell that comes after the specified cell - text nodes are skipped. - * @param {HTMLElement} cell - * @param {Boolean} includeHidden - * @return {HTMLElement} - */ - getCellAfter : function(cell, includeHidden){ - var next = this.getSibling('next', cell); - if(next && !includeHidden && this.colModel.isHidden(next.columnIndex)){ - return this.getCellAfter(next); - } - return next; - }, - - /** - * Returns the cell that comes before the specified cell - text nodes are skipped. - * @param {HTMLElement} cell - * @param {Boolean} includeHidden - * @return {HTMLElement} - */ - getCellBefore : function(cell, includeHidden){ - var prev = this.getSibling('previous', cell); - if(prev && !includeHidden && this.colModel.isHidden(prev.columnIndex)){ - return this.getCellBefore(prev); - } - return prev; - }, - - /** - * Returns the last cell for the row - text nodes and hidden columns are skipped. - * @param {HTMLElement} row - * @param {Boolean} includeHidden - * @return {HTMLElement} - */ - getLastCell : function(row, includeHidden){ - var cell = this.getElement('previous', row.lastChild); - if(cell && !includeHidden && this.colModel.isHidden(cell.columnIndex)){ - return this.getCellBefore(cell); - } - return cell; - }, - - /** - * Returns the first cell for the row - text nodes and hidden columns are skipped. - * @param {HTMLElement} row - * @param {Boolean} includeHidden - * @return {HTMLElement} - */ - getFirstCell : function(row, includeHidden){ - var cell = this.getElement('next', row.firstChild); - if(cell && !includeHidden && this.colModel.isHidden(cell.columnIndex)){ - return this.getCellAfter(cell); - } - return cell; - }, - - /** - * Gets siblings, skipping text nodes - * @param {String} type The direction to walk: 'next' or 'previous' - * @private - */ - getSibling : function(type, node){ - if(!node) return null; - type += 'Sibling'; - var n = node[type]; - while(n && n.nodeType != 1){ - n = n[type]; - } - return n; - }, - - /** - * Returns node if node is an HTMLElement else walks the siblings in direction looking for - * a node that is an element - * @param {String} direction The direction to walk: 'next' or 'previous' - * @private - */ - getElement : function(direction, node){ - if(!node || node.nodeType == 1) return node; - else return this.getSibling(direction, node); - }, - - /** - * @private - */ - getElementFromChild : function(childEl, parentClass){ - if(!childEl || (YAHOO.util.Dom.hasClass(childEl, parentClass))){ - return childEl; - } - var p = childEl.parentNode; - while(p && p.tagName.toUpperCase() != 'BODY'){ - if(YAHOO.util.Dom.hasClass(p, parentClass)){ - return p; - } - p = p.parentNode; - } - return null; - }, - - /** - * Returns the row that contains the specified child element. - * @param {HTMLElement} childEl - * @return {HTMLElement} - */ - getRowFromChild : function(childEl){ - return this.getElementFromChild(childEl, 'ygrid-row'); - }, - - /** - * Returns the cell that contains the specified child element. - * @param {HTMLElement} childEl - * @return {HTMLElement} - */ - getCellFromChild : function(childEl){ - return this.getElementFromChild(childEl, 'ygrid-col'); - }, - - - /** - * Returns the header element that contains the specified child element. - * @param {HTMLElement} childEl - * @return {HTMLElement} - */ - getHeaderFromChild : function(childEl){ - return this.getElementFromChild(childEl, 'ygrid-hd'); - }, - - /** - * Convenience method for getSelectionModel().getSelectedRows() - - * See <small>{@link YAHOO.ext.grid.DefaultSelectionModel#getSelectedRows}</small> for more details. - */ - getSelectedRows : function(){ - return this.selModel.getSelectedRows(); - }, - - /** - * Convenience method for getSelectionModel().getSelectedRows()[0] - - * See <small>{@link YAHOO.ext.grid.DefaultSelectionModel#getSelectedRows}</small> for more details. - */ - getSelectedRow : function(){ - if(this.selModel.hasSelection()){ - return this.selModel.getSelectedRows()[0]; - } - return null; - }, - - /** - * Get the selected row indexes - * @return {Array} Array of indexes - */ - getSelectedRowIndexes : function(){ - var a = []; - var rows = this.selModel.getSelectedRows(); - for(var i = 0; i < rows.length; i++) { - a[i] = rows[i].rowIndex; - } - return a; - }, - - /** - * Gets the first selected row or -1 if none are selected - * @return {Number} - */ - getSelectedRowIndex : function(){ - if(this.selModel.hasSelection()){ - return this.selModel.getSelectedRows()[0].rowIndex; - } - return -1; - }, - - /** - * Convenience method for getSelectionModel().getSelectedRowIds()[0] - - * See <small>{@link YAHOO.ext.grid.DefaultSelectionModel#getSelectedRowIds}</small> for more details. - */ - getSelectedRowId : function(){ - if(this.selModel.hasSelection()){ - return this.selModel.getSelectedRowIds()[0]; - } - return null; - }, - - /** - * Convenience method for getSelectionModel().getSelectedRowIds() - - * See <small>{@link YAHOO.ext.grid.DefaultSelectionModel#getSelectedRowIds}</small> for more details. - */ - getSelectedRowIds : function(){ - return this.selModel.getSelectedRowIds(); - }, - - /** - * Convenience method for getSelectionModel().clearSelections() - - * See <small>{@link YAHOO.ext.grid.DefaultSelectionModel#clearSelections}</small> for more details. - */ - clearSelections : function(){ - this.selModel.clearSelections(); - }, - - - /** - * Convenience method for getSelectionModel().selectAll() - - * See <small>{@link YAHOO.ext.grid.DefaultSelectionModel#selectAll}</small> for more details. - */ - selectAll : function(){ - this.selModel.selectAll(); - }, - - - /** - * Convenience method for getSelectionModel().getCount() - - * See <small>{@link YAHOO.ext.grid.DefaultSelectionModel#getCount}</small> for more details. - */ - getSelectionCount : function(){ - return this.selModel.getCount(); - }, - - /** - * Convenience method for getSelectionModel().hasSelection() - - * See <small>{@link YAHOO.ext.grid.DefaultSelectionModel#hasSelection}</small> for more details. - */ - hasSelection : function(){ - return this.selModel.hasSelection(); - }, - - /** - * Returns the grid's SelectionModel. - */ - getSelectionModel : function(){ - if(!this.selModel){ - this.selModel = new DefaultSelectionModel(); - } - return this.selModel; - }, - - /** - * Returns the grid's DataModel. - */ - getDataModel : function(){ - return this.dataModel; - }, - - /** - * Returns the grid's ColumnModel. - */ - getColumnModel : function(){ - return this.colModel; - }, - - /** - * Returns the grid's GridView object. - */ - getView : function(){ - return this.view; - }, - /** - * Called to get grid's drag proxy text, by default returns this.ddText. - * @return {String} - */ - getDragDropText : function(){ - return this.ddText.replace('%0', this.selModel.getCount()); - } -}; -/** - * Configures the text is the drag proxy (defaults to "%0 selected row(s)"). - * %0 is replaced with the number of selected rows. - * @type String - */ -YAHOO.ext.grid.Grid.prototype.ddText = "%0 selected row(s)";-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.GridDD | -Custom implementation of YAHOO.util.DDProxy used internally by the grid - | -
-// kill dependency issue -if(YAHOO.util.DDProxy){ -/** - * @class - * Custom implementation of YAHOO.util.DDProxy used internally by the grid - * @extends YAHOO.util.DDProxy - */ -YAHOO.ext.grid.GridDD = function(grid, bwrap){ - this.grid = grid; - var ddproxy = document.createElement('div'); - ddproxy.id = grid.container.id + '-ddproxy'; - ddproxy.className = 'ygrid-drag-proxy'; - document.body.insertBefore(ddproxy, document.body.firstChild); - YAHOO.util.Dom.setStyle(ddproxy, 'opacity', .80); - var ddicon = document.createElement('span'); - ddicon.className = 'ygrid-drop-icon ygrid-drop-nodrop'; - ddproxy.appendChild(ddicon); - var ddtext = document.createElement('span'); - ddtext.className = 'ygrid-drag-text'; - ddtext.innerHTML = " "; - ddproxy.appendChild(ddtext); - - this.ddproxy = ddproxy; - this.ddtext = ddtext; - this.ddicon = ddicon; - YAHOO.util.Event.on(bwrap, 'click', this.handleClick, this, true); - YAHOO.ext.grid.GridDD.superclass.constructor.call(this, bwrap.id, 'GridDD', - {dragElId : ddproxy.id, resizeFrame: false}); - - this.unlockDelegate = grid.selModel.unlock.createDelegate(grid.selModel); -}; -YAHOO.extendX(YAHOO.ext.grid.GridDD, YAHOO.util.DDProxy); - -YAHOO.ext.grid.GridDD.prototype.handleMouseDown = function(e){ - var row = this.grid.getRowFromChild(YAHOO.util.Event.getTarget(e)); - if(!row) return; - if(this.grid.selModel.isSelected(row)){ - YAHOO.ext.grid.GridDD.superclass.handleMouseDown.call(this, e); - }else { - this.grid.selModel.unlock(); - YAHOO.ext.EventObject.setEvent(e); - this.grid.selModel.rowClick(this.grid, row.rowIndex, YAHOO.ext.EventObject); - YAHOO.ext.grid.GridDD.superclass.handleMouseDown.call(this, e); - this.grid.selModel.lock(); - } -}; - -YAHOO.ext.grid.GridDD.prototype.handleClick = function(e){ - if(this.grid.selModel.isLocked()){ - setTimeout(this.unlockDelegate, 1); - YAHOO.util.Event.stopEvent(e); - } -}; - -/** - * Updates the DD visual element to allow/not allow a drop - * @param {Boolean} dropStatus True if drop is allowed on the target - */ -YAHOO.ext.grid.GridDD.prototype.setDropStatus = function(dropStatus){ - if(dropStatus === true){ - YAHOO.util.Dom.replaceClass(this.ddicon, 'ygrid-drop-nodrop', 'ygrid-drop-ok'); - }else{ - YAHOO.util.Dom.replaceClass(this.ddicon, 'ygrid-drop-ok', 'ygrid-drop-nodrop'); - } -}; - -YAHOO.ext.grid.GridDD.prototype.startDrag = function(e){ - this.ddtext.innerHTML = this.grid.getDragDropText(); - this.setDropStatus(false); - this.grid.selModel.lock(); - this.grid.fireEvent('startdrag', this.grid, this, e); -}; - -YAHOO.ext.grid.GridDD.prototype.endDrag = function(e){ - YAHOO.util.Dom.setStyle(this.ddproxy, 'visibility', 'hidden'); - this.grid.fireEvent('enddrag', this.grid, this, e); -}; - -YAHOO.ext.grid.GridDD.prototype.autoOffset = function(iPageX, iPageY) { - this.setDelta(-12, -20); -}; - -YAHOO.ext.grid.GridDD.prototype.onDragEnter = function(e, id) { - this.setDropStatus(true); - this.grid.fireEvent('dragenter', this.grid, this, id, e); -}; - -YAHOO.ext.grid.GridDD.prototype.onDragDrop = function(e, id) { - this.grid.fireEvent('dragdrop', this.grid, this, id, e); -}; - -YAHOO.ext.grid.GridDD.prototype.onDragOver = function(e, id) { - this.grid.fireEvent('dragover', this.grid, this, id, e); -}; - -YAHOO.ext.grid.GridDD.prototype.onDragOut = function(e, id) { - this.setDropStatus(false); - this.grid.fireEvent('dragout', this.grid, this, id, e); -}; -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.GridView | -Default UI code used internally by the Grid. | -
| YAHOO.ext.grid.HeaderController | -Used internal by GridView to route header related events. | -
/** - * @class - * Default UI code used internally by the Grid. Documentation to come. - * @constructor - */ -YAHOO.ext.grid.GridView = function(){ - /** @private */ - this.grid = null; - - /** @private */ - this.lastFocusedRow = null; - /** - * Fires when the ViewPort is scrolled - fireDirect sig: (this, scrollLeft, scrollTop) - * @type YAHOO.util.CustomEvent - * @deprecated - */ - this.onScroll = new YAHOO.util.CustomEvent('onscroll'); - - /** - * @private - */ - this.adjustScrollTask = new YAHOO.ext.util.DelayedTask(this._adjustForScroll, this); - /** - * @private - */ - this.ensureVisibleTask = new YAHOO.ext.util.DelayedTask(); -}; - -YAHOO.ext.grid.GridView.prototype = { - init: function(grid){ - this.grid = grid; - }, - - fireScroll: function(scrollLeft, scrollTop){ - this.onScroll.fireDirect(this.grid, scrollLeft, scrollTop); - }, - - /** - * Utility method that gets an array of the cell renderers - */ - getColumnRenderers : function(){ - var renderers = []; - var cm = this.grid.colModel; - var colCount = cm.getColumnCount(); - for(var i = 0; i < colCount; i++){ - renderers.push(cm.getRenderer(i)); - } - return renderers; - }, - - buildIndexMap : function(){ - var colToData = {}; - var dataToCol = {}; - var cm = this.grid.colModel; - for(var i = 0, len = cm.getColumnCount(); i < len; i++){ - var di = cm.getDataIndex(i); - colToData[i] = di; - dataToCol[di] = i; - } - return {'colToData': colToData, 'dataToCol': dataToCol}; - }, - - getDataIndexes : function(){ - if(!this.indexMap){ - this.indexMap = this.buildIndexMap(); - } - return this.indexMap.colToData; - }, - - getColumnIndexByDataIndex : function(dataIndex){ - if(!this.indexMap){ - this.indexMap = this.buildIndexMap(); - } - return this.indexMap.dataToCol[dataIndex]; - }, - - updateHeaders : function(){ - var colModel = this.grid.colModel; - var hcells = this.headers; - var colCount = colModel.getColumnCount(); - for(var i = 0; i < colCount; i++){ - hcells[i].textNode.innerHTML = colModel.getColumnHeader(i); - } - }, - - adjustForScroll : function(disableDelay){ - if(!disableDelay){ - this.adjustScrollTask.delay(50); - }else{ - this._adjustForScroll(); - } - }, - - getCellAtPoint : function(x, y){ - var colIndex = null; - var rowIndex = null; - - // translate page coordinates to local coordinates - var xy = YAHOO.util.Dom.getXY(this.wrap); - x = (x - xy[0]) + this.wrap.scrollLeft; - y = (y - xy[1]) + this.wrap.scrollTop; - - var colModel = this.grid.colModel; - var pos = 0; - var colCount = colModel.getColumnCount(); - for(var i = 0; i < colCount; i++){ - if(colModel.isHidden(i)) continue; - var width = colModel.getColumnWidth(i); - if(x >= pos && x < pos+width){ - colIndex = i; - break; - } - pos += width; - } - if(colIndex != null){ - rowIndex = (y == 0 ? 0 : Math.floor(y / this.getRowHeight())); - if(rowIndex >= this.grid.dataModel.getRowCount()){ - return null; - } - return [colIndex, rowIndex]; - } - return null; - }, - - /** @private */ - _adjustForScroll : function(){ - this.forceScrollUpdate(); - if(this.scrollbarMode == YAHOO.ext.grid.GridView.SCROLLBARS_OVERLAP){ - var adjustment = 0; - if(this.wrap.clientWidth && this.wrap.clientWidth != 0){ - adjustment = this.wrap.offsetWidth - this.wrap.clientWidth; - } - this.hwrap.setWidth(this.wrap.offsetWidth-adjustment); - }else{ - this.hwrap.setWidth(this.wrap.offsetWidth); - } - this.bwrap.setWidth(Math.max(this.grid.colModel.getTotalWidth(), this.wrap.clientWidth)); - }, - - focusRow : function(row){ - if(typeof row == 'number'){ - row = this.getBodyTable().childNodes[row]; - } - if(!row) return; - var left = this.wrap.scrollLeft; - try{ // try catch for IE occasional focus bug - row.childNodes.item(0).hideFocus = true; - row.childNodes.item(0).focus(); - }catch(e){} - this.ensureVisible(row); - this.wrap.scrollLeft = left; - this.handleScroll(); - this.lastFocusedRow = row; - }, - - ensureVisible : function(row, disableDelay){ - if(!disableDelay){ - this.ensureVisibleTask.delay(50, this._ensureVisible, this, [row]); - }else{ - this._ensureVisible(row); - } - }, - - /** @ignore */ - _ensureVisible : function(row){ - if(typeof row == 'number'){ - row = this.getBodyTable().childNodes[row]; - } - if(!row) return; - var left = this.wrap.scrollLeft; - var rowTop = parseInt(row.offsetTop, 10); // parseInt for safari bug - var rowBottom = rowTop + row.offsetHeight; - var clientTop = parseInt(this.wrap.scrollTop, 10); // parseInt for safari bug - var clientBottom = clientTop + this.wrap.clientHeight; - if(rowTop < clientTop){ - this.wrap.scrollTop = rowTop; - }else if(rowBottom > clientBottom){ - this.wrap.scrollTop = rowBottom-this.wrap.clientHeight; - } - this.wrap.scrollLeft = left; - this.handleScroll(); - }, - - updateColumns : function(){ - this.grid.stopEditing(); - var colModel = this.grid.colModel; - var hcols = this.headers; - var colCount = colModel.getColumnCount(); - var pos = 0; - var totalWidth = colModel.getTotalWidth(); - for(var i = 0; i < colCount; i++){ - if(colModel.isHidden(i)) continue; - var width = colModel.getColumnWidth(i); - hcols[i].style.width = width + 'px'; - hcols[i].style.left = pos + 'px'; - hcols[i].split.style.left = (pos+width-3) + 'px'; - this.setCSSWidth(i, width, pos); - pos += width; - } - this.lastWidth = totalWidth; - this.bwrap.setWidth(Math.max(totalWidth, this.wrap.clientWidth)); - if(!YAHOO.ext.util.Browser.isIE){ // fix scrolling prob in gecko and opera - this.wrap.scrollLeft = this.hwrap.dom.scrollLeft; - } - this.syncScroll(); - this.forceScrollUpdate(); - }, - - setCSSWidth : function(colIndex, width, pos){ - var selector = ["#" + this.grid.id + " .ygrid-col-" + colIndex, ".ygrid-col-" + colIndex]; - YAHOO.ext.util.CSS.updateRule(selector, 'width', width + 'px'); - if(typeof pos == 'number'){ - YAHOO.ext.util.CSS.updateRule(selector, 'left', pos + 'px'); - } - }, - - handleHiddenChange : function(colModel, colIndex, hidden){ - if(hidden){ - this.hideColumn(colIndex); - }else{ - this.unhideColumn(colIndex); - } - this.updateColumns(); - }, - - hideColumn : function(colIndex){ - var selector = ["#" + this.grid.id + " .ygrid-col-" + colIndex, ".ygrid-col-" + colIndex]; - YAHOO.ext.util.CSS.updateRule(selector, 'position', 'absolute'); - YAHOO.ext.util.CSS.updateRule(selector, 'visibility', 'hidden'); - - this.headers[colIndex].style.display = 'none'; - this.headers[colIndex].split.style.display = 'none'; - }, - - unhideColumn : function(colIndex){ - var selector = ["#" + this.grid.id + " .ygrid-col-" + colIndex, ".ygrid-col-" + colIndex]; - YAHOO.ext.util.CSS.updateRule(selector, 'position', ''); - YAHOO.ext.util.CSS.updateRule(selector, 'visibility', 'visible'); - - this.headers[colIndex].style.display = ''; - this.headers[colIndex].split.style.display = ''; - }, - - getBodyTable : function(){ - return this.bwrap.dom; - }, - - updateRowIndexes : function(firstRow, lastRow){ - var stripeRows = this.grid.stripeRows; - var bt = this.getBodyTable(); - var nodes = bt.childNodes; - firstRow = firstRow || 0; - lastRow = lastRow || nodes.length-1; - var re = /^(?:ygrid-row ygrid-row-alt|ygrid-row)/; - for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){ - var node = nodes[rowIndex]; - if(stripeRows && (rowIndex+1) % 2 == 0){ - node.className = node.className.replace(re, 'ygrid-row ygrid-row-alt'); - }else{ - node.className = node.className.replace(re, 'ygrid-row'); - } - node.rowIndex = rowIndex; - nodes[rowIndex].style.top = (rowIndex * this.rowHeight) + 'px'; - } - }, - - insertRows : function(dataModel, firstRow, lastRow){ - this.updateBodyHeight(); - this.adjustForScroll(true); - var renderers = this.getColumnRenderers(); - var dindexes = this.getDataIndexes(); - var colCount = this.grid.colModel.getColumnCount(); - var beforeRow = null; - var bt = this.getBodyTable(); - if(firstRow < bt.childNodes.length){ - beforeRow = bt.childNodes[firstRow]; - } - for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){ - var row = document.createElement('span'); - row.className = 'ygrid-row'; - row.style.top = (rowIndex * this.rowHeight) + 'px'; - this.renderRow(dataModel, row, rowIndex, colCount, renderers, dindexes); - if(beforeRow){ - bt.insertBefore(row, beforeRow); - }else{ - bt.appendChild(row); - } - } - this.updateRowIndexes(firstRow); - this.adjustForScroll(); - }, - - renderRow : function(dataModel, row, rowIndex, colCount, renderers, dindexes){ - for(var colIndex = 0; colIndex < colCount; colIndex++){ - var td = document.createElement('span'); - td.className = 'ygrid-col ygrid-col-' + colIndex + (colIndex == colCount-1 ? ' ygrid-col-last' : ''); - td.columnIndex = colIndex; - td.tabIndex = 0; - var span = document.createElement('span'); - span.className = 'ygrid-cell-text'; - td.appendChild(span); - var val = renderers[colIndex](dataModel.getValueAt(rowIndex, dindexes[colIndex]), rowIndex, colIndex); - if(val == '') val = ' '; - span.innerHTML = val; - row.appendChild(td); - } - }, - - deleteRows : function(dataModel, firstRow, lastRow){ - this.updateBodyHeight(); - // first make sure they are deselected - this.grid.selModel.deselectRange(firstRow, lastRow); - var bt = this.getBodyTable(); - var rows = []; // get references because the rowIndex will change - for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){ - rows.push(bt.childNodes[rowIndex]); - } - for(var i = 0; i < rows.length; i++){ - bt.removeChild(rows[i]); - rows[i] = null; - } - rows = null; - this.updateRowIndexes(firstRow); - this.adjustForScroll(); - }, - - updateRows : function(dataModel, firstRow, lastRow){ - var bt = this.getBodyTable(); - var dindexes = this.getDataIndexes(); - var renderers = this.getColumnRenderers(); - var colCount = this.grid.colModel.getColumnCount(); - for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){ - var row = bt.rows[rowIndex]; - var cells = row.childNodes; - for(var colIndex = 0; colIndex < colCount; colIndex++){ - var td = cells[colIndex]; - var val = renderers[colIndex](dataModel.getValueAt(rowIndex, dindexes[colIndex]), rowIndex, colIndex); - if(val == '') val = ' '; - td.firstChild.innerHTML = val; - } - } - }, - - handleSort : function(dataModel, sortColumnIndex, sortDir, noRefresh){ - this.grid.selModel.syncSelectionsToIds(); - if(!noRefresh){ - this.updateRows(dataModel, 0, dataModel.getRowCount()-1); - } - this.updateHeaderSortState(); - if(this.lastFocusedRow){ - this.focusRow(this.lastFocusedRow); - } - }, - - syncScroll : function(){ - this.hwrap.dom.scrollLeft = this.wrap.scrollLeft; - }, - - handleScroll : function(){ - this.syncScroll(); - this.fireScroll(this.wrap.scrollLeft, this.wrap.scrollTop); - this.grid.fireEvent('bodyscroll', this.wrap.scrollLeft, this.wrap.scrollTop); - }, - - getRowHeight : function(){ - if(!this.rowHeight){ - var rule = YAHOO.ext.util.CSS.getRule(["#" + this.grid.id + " .ygrid-row", ".ygrid-row"]); - if(rule && rule.style.height){ - this.rowHeight = parseInt(rule.style.height, 10); - }else{ - this.rowHeight = 21; - } - } - return this.rowHeight; - }, - - renderRows : function(dataModel){ - if(this.grid.selModel){ - this.grid.selModel.clearSelections(); - } - var bt = this.getBodyTable(); - bt.innerHTML = ''; - this.rowHeight = this.getRowHeight(); - this.insertRows(dataModel, 0, dataModel.getRowCount()-1); - }, - - updateCell : function(dataModel, rowIndex, dataIndex){ - var colIndex = this.getColumnIndexByDataIndex(dataIndex); - if(typeof colIndex == 'undefined'){ // not present in grid - return; - } - var bt = this.getBodyTable(); - var row = bt.childNodes[rowIndex]; - var cell = row.childNodes[colIndex]; - var renderer = this.grid.colModel.getRenderer(colIndex); - var val = renderer(dataModel.getValueAt(rowIndex, dataIndex), rowIndex, colIndex); - if(val == '') val = ' '; - cell.firstChild.innerHTML = val; - }, - - calcColumnWidth : function(colIndex, maxRowsToMeasure){ - var maxWidth = 0; - var bt = this.getBodyTable(); - var rows = bt.childNodes; - var stopIndex = Math.min(maxRowsToMeasure || rows.length, rows.length); - if(this.grid.autoSizeHeaders){ - var h = this.headers[colIndex]; - var curWidth = h.style.width; - h.style.width = this.grid.minColumnWidth+'px'; - maxWidth = Math.max(maxWidth, h.scrollWidth); - h.style.width = curWidth; - } - for(var i = 0; i < stopIndex; i++){ - var cell = rows[i].childNodes[colIndex].firstChild; - maxWidth = Math.max(maxWidth, cell.scrollWidth); - } - return maxWidth + /*margin for error in IE*/ 5; - }, - - autoSizeColumn : function(colIndex, forceMinSize){ - if(forceMinSize){ - this.setCSSWidth(colIndex, this.grid.minColumnWidth); - } - var newWidth = this.calcColumnWidth(colIndex); - this.grid.colModel.setColumnWidth(colIndex, - Math.max(this.grid.minColumnWidth, newWidth)); - this.grid.fireEvent('columnresize', colIndex, newWidth); - }, - - autoSizeColumns : function(){ - var colModel = this.grid.colModel; - var colCount = colModel.getColumnCount(); - var wrap = this.wrap; - for(var i = 0; i < colCount; i++){ - this.setCSSWidth(i, this.grid.minColumnWidth); - colModel.setColumnWidth(i, this.calcColumnWidth(i, this.grid.maxRowsToMeasure), true); - } - if(colModel.getTotalWidth() < wrap.clientWidth){ - var diff = Math.floor((wrap.clientWidth - colModel.getTotalWidth()) / colCount); - for(var i = 0; i < colCount; i++){ - colModel.setColumnWidth(i, colModel.getColumnWidth(i) + diff, true); - } - } - this.updateColumns(); - }, - - updateWrapHeight : function(){ - var box = this.grid.container.getBox(true); - this.wrapEl.setHeight(box.height-this.footerHeight-parseInt(this.wrap.offsetTop, 10)); - }, - - forceScrollUpdate : function(){ - var wrap = this.wrap; - YAHOO.util.Dom.setStyle(wrap, 'width', (wrap.offsetWidth) +'px'); - setTimeout(function(){ // set timeout so FireFox works - YAHOO.util.Dom.setStyle(wrap, 'width', ''); - }, 1); - }, - - updateHeaderSortState : function(){ - var state = this.grid.dataModel.getSortState(); - var sortColumn = this.getColumnIndexByDataIndex(state.column); - var sortDir = state.direction; - for(var i = 0, len = this.headers.length; i < len; i++){ - var h = this.headers[i]; - if(i != sortColumn){ - h.sortDesc.style.display = 'none'; - h.sortAsc.style.display = 'none'; - }else{ - h.sortDesc.style.display = sortDir == 'DESC' ? 'block' : 'none'; - h.sortAsc.style.display = sortDir == 'ASC' ? 'block' : 'none'; - } - } - }, - - render : function(){ - var grid = this.grid; - var container = grid.container.dom; - var dataModel = grid.dataModel; - dataModel.onCellUpdated.subscribe(this.updateCell, this, true); - dataModel.onTableDataChanged.subscribe(this.renderRows, this, true); - dataModel.onRowsDeleted.subscribe(this.deleteRows, this, true); - dataModel.onRowsInserted.subscribe(this.insertRows, this, true); - dataModel.onRowsUpdated.subscribe(this.updateRows, this, true); - dataModel.onRowsSorted.subscribe(this.handleSort, this, true); - - var colModel = grid.colModel; - colModel.onWidthChange.subscribe(this.updateColumns, this, true); - colModel.onHeaderChange.subscribe(this.updateHeaders, this, true); - colModel.onHiddenChange.subscribe(this.handleHiddenChange, this, true); - - YAHOO.util.Event.on(window, 'resize', this.adjustForScroll, this, true); - YAHOO.util.Event.on(window, 'resize', this.updateWrapHeight, this, true); - - var autoSizeDelegate = this.autoSizeColumn.createDelegate(this); - - var colCount = colModel.getColumnCount(); - - var dh = YAHOO.ext.DomHelper; - //create wrapper elements that handle offsets and scrolling - var wrap = dh.append(container, {tag: 'div', cls: 'ygrid-wrap'}); - this.wrap = wrap; - this.wrapEl = getEl(wrap, true); - YAHOO.ext.EventManager.on(wrap, 'scroll', this.handleScroll, this, true); - - var hwrap = dh.append(container, {tag: 'div', cls: 'ygrid-wrap-headers'}); - this.hwrap = getEl(hwrap, true); - - var bwrap = dh.append(wrap, {tag: 'div', cls: 'ygrid-wrap-body', id: container.id + '-body'}); - this.bwrap = getEl(bwrap, true); - this.bwrap.setWidth(colModel.getTotalWidth()); - bwrap.rows = bwrap.childNodes; - - this.footerHeight = 0; - var foot = this.appendFooter(container); - if(foot){ - this.footer = getEl(foot, true); - this.footerHeight = this.footer.getHeight(); - } - this.updateWrapHeight(); - - var hrow = dh.append(hwrap, {tag: 'span', cls: 'ygrid-hrow'}); - this.hrow = hrow; - - // IE doesn't like iframes, we will leave this alone - var iframe = document.createElement('iframe'); - iframe.className = 'ygrid-hrow-frame'; - iframe.frameBorder = 0; - hwrap.appendChild(iframe); - - this.headerCtrl = new YAHOO.ext.grid.HeaderController(this.grid); - this.headers = []; - this.cols = []; - - - - var htemplate = dh.createTemplate({ - tag: 'span', cls: 'ygrid-hd ygrid-header-{0}', children: [{ - tag: 'span', - cls: 'ygrid-hd-body', - html: '<table border="0" cellpadding="0" cellspacing="0">' + - '<tbody><tr><td><span>{1}</span></td>' + - '<td><span class="sort-desc"></span><span class="sort-asc"></span></td>' + - '</tr></tbody></table>' - }] - }); - htemplate.compile(); - for(var i = 0; i < colCount; i++){ - var hd = htemplate.append(hrow, [i, colModel.getColumnHeader(i)]); - var spans = hd.getElementsByTagName('span'); - hd.textNode = spans[1]; - hd.sortDesc = spans[2]; - hd.sortAsc = spans[3]; - hd.columnIndex = i; - this.headers.push(hd); - if(colModel.isSortable(i)){ - this.headerCtrl.register(hd); - } - var split = dh.append(hrow, {tag: 'span', cls: 'ygrid-hd-split'}); - hd.split = split; - - YAHOO.util.Event.on(split, 'dblclick', autoSizeDelegate.createCallback(i+0, true)); - - var sb = new YAHOO.ext.SplitBar(split, hd, null, YAHOO.ext.SplitBar.LEFT); - sb.columnIndex = i; - sb.minSize = grid.minColumnWidth; - sb.onMoved.subscribe(this.onColumnSplitterMoved, this, true); - YAHOO.util.Dom.addClass(sb.proxy, 'ygrid-column-sizer'); - YAHOO.util.Dom.setStyle(sb.proxy, 'background-color', ''); - sb.dd._resizeProxy = function(){ - var el = this.getDragEl(); - YAHOO.util.Dom.setStyle(el, 'height', (hwrap.clientHeight+wrap.clientHeight-2) +'px'); - }; - } - if(grid.autoSizeColumns){ - this.renderRows(dataModel); - this.autoSizeColumns(); - }else{ - this.updateColumns(); - this.renderRows(dataModel); - } - - for(var i = 0; i < colCount; i++){ - if(colModel.isHidden(i)){ - this.hideColumn(i); - } - } - return this.bwrap; - - /* - // Old DOM code - //create wrapper elements that handle offsets and scrolling - var wrap = document.createElement('div'); - wrap.className = 'ygrid-wrap'; - grid.container.dom.appendChild(wrap); - this.wrap = wrap; - this.wrapEl = getEl(wrap, true); - YAHOO.ext.EventManager.on(wrap, 'scroll', this.handleScroll, this, true); - - var hwrap = document.createElement('div'); - hwrap.className = 'ygrid-wrap-headers'; - grid.container.dom.appendChild(hwrap); - this.hwrap = getEl(hwrap, true); - //this.hwrap.setWidth(colModel.getTotalWidth()); - - var bwrap = document.createElement('div'); - bwrap.id = grid.container.id + '-body'; - bwrap.className = 'ygrid-wrap-body'; - wrap.appendChild(bwrap); - this.bwrap = getEl(bwrap, true); - this.bwrap.setWidth(colModel.getTotalWidth()); - bwrap.rows = bwrap.childNodes; - - this.footerHeight = 0; - var foot = this.appendFooter(grid.container.dom); - if(foot){ - this.footer = getEl(foot, true); - this.footerHeight = this.footer.getHeight(); - } - this.updateWrapHeight(); - - var hrow = document.createElement('span'); - hrow.className = 'ygrid-hrow'; - hwrap.appendChild(hrow); - var iframe = document.createElement('iframe'); - iframe.className = 'ygrid-hrow-frame'; - iframe.frameBorder = 0; - hwrap.appendChild(iframe); - this.hrow = hrow; - this.headerCtrl = new YAHOO.ext.grid.HeaderController(this.grid); - this.headers = []; - this.cols = []; - for(var i = 0; i < colCount; i++){ - var hd = document.createElement('span'); - hd.className = 'ygrid-hd ygrid-header-' + i; - var span = document.createElement('span'); - span.className = 'ygrid-hd-body'; - hd.appendChild(span); - var tb = document.createElement('table'); - span.appendChild(tb); - tb.border = 0; - tb.cellPadding=0; - tb.cellSpacing = 0; - var tbody = document.createElement('tbody'); - tb.appendChild(tbody); - var tr = document.createElement('tr'); - tbody.appendChild(tr); - var td = document.createElement('td'); - tr.appendChild(td); - var td2 = document.createElement('td'); - tr.appendChild(td2); - var text = document.createElement('span'); - text.innerHTML = colModel.getColumnHeader(i); - td.appendChild(text); - hd.textNode = text; - hd.sortDesc = document.createElement('span'); - hd.sortDesc.className = 'sort-desc'; - hd.sortAsc = document.createElement('span'); - hd.sortAsc.className = 'sort-asc'; - td2.appendChild(hd.sortDesc); - td2.appendChild(hd.sortAsc); - hrow.appendChild(hd) - hd.columnIndex = i; - this.headers.push(hd); - if(colModel.isSortable(i)){ - this.headerCtrl.register(hd); - } - var split = document.createElement('span'); - split.className = 'ygrid-hd-split'; - hrow.appendChild(split); - hd.split = split; - - YAHOO.util.Event.on(split, 'dblclick', autoSizeDelegate.createCallback(i+0, true)); - - var sb = new YAHOO.ext.SplitBar(split, hd, null, YAHOO.ext.SplitBar.LEFT); - sb.columnIndex = i; - sb.minSize = grid.minColumnWidth; - // anonymous function = bad? - sb.onMoved.subscribe(function(splitter, newSize){ - colModel.setColumnWidth(splitter.columnIndex, newSize); - grid.fireEvent('columnresize', splitter.columnIndex, newSize); - }); - YAHOO.util.Dom.addClass(sb.proxy, 'ygrid-column-sizer'); - YAHOO.util.Dom.setStyle(sb.proxy, 'background-color', ''); - sb.dd._resizeProxy = function(){ - var el = this.getDragEl(); - YAHOO.util.Dom.setStyle(el, 'height', (hwrap.clientHeight+wrap.clientHeight-2) +'px'); - }; - } - if(grid.autoSizeColumns){ - this.renderRows(dataModel); - this.autoSizeColumns(); - }else{ - this.updateColumns(); - this.renderRows(dataModel); - } - - for(var i = 0; i < colCount; i++){ - if(colModel.isHidden(i)){ - this.hideColumn(i); - } - } - return this.bwrap;*/ - }, - - onColumnSplitterMoved : function(splitter, newSize){ - this.grid.colModel.setColumnWidth(splitter.columnIndex, newSize); - this.grid.fireEvent('columnresize', splitter.columnIndex, newSize); - }, - - appendFooter : function(parentEl){ - return null; - }, - - updateBodyHeight : function(){ - YAHOO.util.Dom.setStyle(this.getBodyTable(), 'height', - (this.grid.dataModel.getRowCount()*this.rowHeight)+'px'); - } -}; -YAHOO.ext.grid.GridView.SCROLLBARS_UNDER = 0; -YAHOO.ext.grid.GridView.SCROLLBARS_OVERLAP = 1; -YAHOO.ext.grid.GridView.prototype.scrollbarMode = YAHOO.ext.grid.GridView.SCROLLBARS_UNDER; - -/** - * @class - * Used internal by GridView to route header related events. - * @constructor - */ -YAHOO.ext.grid.HeaderController = function(grid){ - /** @private */ - this.grid = grid; - /** @private */ - this.headers = []; -}; - -YAHOO.ext.grid.HeaderController.prototype = { - register : function(header){ - this.headers.push(header); - YAHOO.ext.EventManager.on(header, 'selectstart', this.cancelTextSelection, this, true); - YAHOO.ext.EventManager.on(header, 'mousedown', this.cancelTextSelection, this, true); - YAHOO.ext.EventManager.on(header, 'mouseover', this.headerOver, this, true); - YAHOO.ext.EventManager.on(header, 'mouseout', this.headerOut, this, true); - YAHOO.ext.EventManager.on(header, 'click', this.headerClick, this, true); - }, - - headerClick : function(e){ - var grid = this.grid, cm = grid.colModel, dm = grid.dataModel; - grid.stopEditing(); - var header = grid.getHeaderFromChild(e.getTarget()); - var direction = header.sortDir || 'ASC'; - var state = dm.getSortState(); - if(typeof state.column != 'undefined' && - grid.getView().getColumnIndexByDataIndex(state.column) == header.columnIndex){ - direction = (direction == 'ASC' ? 'DESC' : 'ASC'); - } - header.sortDir = direction; - dm.sort(cm, cm.getDataIndex(header.columnIndex), direction); - }, - - headerOver : function(e){ - var header = this.grid.getHeaderFromChild(e.getTarget()); - YAHOO.util.Dom.addClass(header, 'ygrid-hd-over'); - //YAHOO.ext.util.CSS.applyFirst(header, this.grid.id, '.ygrid-hd-over'); - }, - - headerOut : function(e){ - var header = this.grid.getHeaderFromChild(e.getTarget()); - YAHOO.util.Dom.removeClass(header, 'ygrid-hd-over'); - //YAHOO.ext.util.CSS.revertFirst(header, this.grid.id, '.ygrid-hd-over'); - }, - - cancelTextSelection : function(e){ - e.preventDefault(); - } -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.JSONDataModel | -This is an implementation of a DataModel used by the Grid. | -
-/** - * @class - * This is an implementation of a DataModel used by the Grid. It works - * with JSON data. - * <br>Example schema: - * <pre><code> - * var schema = { - * root: 'Results.Result', - * id: 'ASIN', - * fields: ['Author', 'Title', 'Manufacturer', 'ProductGroup'] - * }; - * </code></pre> - * @extends YAHOO.ext.grid.LoadableDataModel - * @constructor -*/ -YAHOO.ext.grid.JSONDataModel = function(schema){ - YAHOO.ext.grid.JSONDataModel.superclass.constructor.call(this, YAHOO.ext.grid.LoadableDataModel.JSON); - /**@private*/ - this.schema = schema; -}; -YAHOO.extendX(YAHOO.ext.grid.JSONDataModel, YAHOO.ext.grid.LoadableDataModel); - -/** - * Overrides loadData in LoadableDataModel to process JSON data - * @param {Object} data The JSON object to load - * @param {Function} callback - */ -YAHOO.ext.grid.JSONDataModel.prototype.loadData = function(data, callback, keepExisting){ - var idField = this.schema.id; - var fields = this.schema.fields; - var rowData = []; - try{ - var root = eval('data.' + this.schema.root); - for(var i = 0; i < root.length; i++){ - var node = root[i]; - var colData = []; - colData.node = node; - colData.id = node[idField] || String(i); - for(var j = 0; j < fields.length; j++) { - var val = node[fields[j]] || ""; - if(this.preprocessors[j]){ - val = this.preprocessors[j](val); - } - colData.push(val); - } - rowData.push(colData); - } - if(keepExisting !== true){ - this.removeAll(); - } - this.addRows(rowData); - if(typeof callback == 'function'){ - callback(this, true); - } - this.fireLoadEvent(); - }catch(e){ - this.fireLoadException(e, null); - if(typeof callback == 'function'){ - callback(this, false); - } - } -}; - -/** - * Overrides getRowId in DefaultDataModel to return the ID value of the specified node. - * @param {Number} rowIndex - * @return {Number} - */ -YAHOO.ext.grid.JSONDataModel.prototype.getRowId = function(rowIndex){ - return this.data[rowIndex].id; -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.LoadableDataModel | -This class extends DefaultDataModel and adds the core functionality to load data remotely. | -
/** - * @class - * This class extends DefaultDataModel and adds the core functionality to load data remotely. <br><br> - * @extends YAHOO.ext.grid.DefaultDataModel - * @constructor - * @param {String} dataType YAHOO.ext.grid.LoadableDataModel.XML, YAHOO.ext.grid.LoadableDataModel.TEXT or YAHOO.ext.grid.JSON -*/ -YAHOO.ext.grid.LoadableDataModel = function(dataType){ - YAHOO.ext.grid.LoadableDataModel.superclass.constructor.call(this, []); - - /** Fires when a successful load is completed - fireDirect sig: (this) - * @type YAHOO.util.CustomEvent - * @deprecated Use addListener instead of accessing directly - */ - this.onLoad = new YAHOO.util.CustomEvent('load'); - /** Fires when a load fails - fireDirect sig: (this, errorMsg, responseObj) - * @type YAHOO.util.CustomEvent - * @deprecated Use addListener instead of accessing directly - */ - this.onLoadException = new YAHOO.util.CustomEvent('loadException'); - - this.events['load'] = this.onLoad; - this.events['beforeload'] = new YAHOO.util.CustomEvent('beforeload'); - this.events['loadexception'] = this.onLoadException; - - /**@private*/ - this.dataType = dataType; - /**@private*/ - this.preprocessors = []; - /**@private*/ - this.postprocessors = []; - - // paging info - /** The active page @type Number*/ - this.loadedPage = 1; - /** True to use remote sorting, initPaging automatically sets this to true @type Boolean */ - this.remoteSort = false; - /** The number of records per page @type Number*/ - this.pageSize = 0; - /** The script/page to call to provide paged/sorted data @type String*/ - this.pageUrl = null; - /** An object of key/value pairs to be passed as parameters - * when loading pages/sorting @type Object*/ - this.baseParams = {}; - /** Maps named params to url parameters - Override to specify your own param names */ - this.paramMap = {'page':'page', 'pageSize':'pageSize', 'sortColumn':'sortColumn', 'sortDir':'sortDir'}; - -}; -YAHOO.extendX(YAHOO.ext.grid.LoadableDataModel, YAHOO.ext.grid.DefaultDataModel); - -/** @ignore */ -YAHOO.ext.grid.LoadableDataModel.prototype.setLoadedPage = function(pageNum, userCallback){ - this.loadedPage = pageNum; - if(typeof userCallback == 'function'){ - userCallback(); - } -}; - -/** Returns true if this model uses paging @type Boolean */ -YAHOO.ext.grid.LoadableDataModel.prototype.isPaged = function(){ - return this.pageSize > 0; -}; - -/** Returns the total number of records available, override if needed @type Number */ -YAHOO.ext.grid.LoadableDataModel.prototype.getTotalRowCount = function(){ - return this.totalCount || this.getRowCount(); -}; - -/** Returns the number of records per page @type Number */ -YAHOO.ext.grid.LoadableDataModel.prototype.getPageSize = function(){ - return this.pageSize; -}; - -/** Returns the total number of pages available @type Number */ -YAHOO.ext.grid.LoadableDataModel.prototype.getTotalPages = function(){ - if(this.getPageSize() == 0 || this.getTotalRowCount() == 0){ - return 1; - } - return Math.ceil(this.getTotalRowCount()/this.getPageSize()); -}; - -/** Initializes paging for this model. */ -YAHOO.ext.grid.LoadableDataModel.prototype.initPaging = function(url, pageSize, baseParams){ - this.pageUrl = url; - this.pageSize = pageSize; - this.remoteSort = true; - if(baseParams) this.baseParams = baseParams; -}; - -/** @ignore */ -YAHOO.ext.grid.LoadableDataModel.prototype.createParams = function(pageNum, sortColumn, sortDir){ - var params = {}, map = this.paramMap; - for(var key in this.baseParams){ - if(typeof this.baseParams[key] != 'function'){ - params[key] = this.baseParams[key]; - } - } - params[map['page']] = pageNum; - params[map['pageSize']] = this.getPageSize(); - params[map['sortColumn']] = (typeof sortColumn == 'undefined' ? '' : sortColumn); - params[map['sortDir']] = sortDir || ''; - return params; -}; - -YAHOO.ext.grid.LoadableDataModel.prototype.loadPage = function(pageNum, callback, keepExisting){ - var sort = this.getSortState(); - var params = this.createParams(pageNum, sort.column, sort.direction); - this.load(this.pageUrl, params, this.setLoadedPage.createDelegate(this, [pageNum, callback]), - keepExisting ? (pageNum-1) * this.pageSize : null); -}; - -/** @ignore */ -YAHOO.ext.grid.LoadableDataModel.prototype.applySort = function(suppressEvent){ - if(!this.remoteSort){ - YAHOO.ext.grid.LoadableDataModel.superclass.applySort.apply(this, arguments); - }else if(!suppressEvent){ - var sort = this.getSortState(); - if(sort.column){ - this.fireRowsSorted(sort.column, sort.direction, true); - } - } -}; - -/** @ignore */ -YAHOO.ext.grid.LoadableDataModel.prototype.resetPaging = function(){ - this.loadedPage = 1; -}; - -/** Overridden sort method to use remote sorting if turned on */ -YAHOO.ext.grid.LoadableDataModel.prototype.sort = function(columnModel, columnIndex, direction, suppressEvent){ - if(!this.remoteSort){ - YAHOO.ext.grid.LoadableDataModel.superclass.sort.apply(this, arguments); - }else{ - this.columnModel = columnModel; - this.sortColumn = columnIndex; - this.sortDir = direction; - var params = this.createParams(this.loadedPage, columnIndex, direction); - this.load(this.pageUrl, params, this.fireRowsSorted.createDelegate(this, [columnIndex, direction, true])); - } -} -/** - * Initiates the loading of the data from the specified URL - Failed load attempts will - * fire the {@link #onLoadException} event. - * @param {Object/String} url The url from which the data can be loaded - * @param {<i>String/Object</i>} params (optional) The parameters to pass as either a url encoded string "param1=1&param2=2" or as an object {param1: 1, param2: 2} - * @param {<i>Function</i>} callback (optional) Callback when load is complete - called with signature (this, rowCountLoaded) - * @param {<i>Number</i>} insertIndex (optional) if present, loaded data is inserted at the specified index instead of overwriting existing data - */ -YAHOO.ext.grid.LoadableDataModel.prototype.load = function(url, params, callback, insertIndex){ - this.fireEvent('beforeload'); - if(params && typeof params != 'string'){ // must be object - var buf = []; - for(var key in params){ - if(typeof params[key] != 'function'){ - buf.push(encodeURIComponent(key), '=', encodeURIComponent(params[key]), '&'); - } - } - delete buf[buf.length-1]; - params = buf.join(''); - } - var cb = { - success: this.processResponse, - failure: this.processException, - scope: this, - argument: {callback: callback, insertIndex: insertIndex} - }; - var method = params ? 'POST' : 'GET'; - YAHOO.util.Connect.asyncRequest(method, url, cb, params); -}; - -/**@private*/ -YAHOO.ext.grid.LoadableDataModel.prototype.processResponse = function(response){ - var cb = response.argument.callback; - var keepExisting = (typeof response.argument.insertIndex == 'number'); - var insertIndex = response.argument.insertIndex; - switch(this.dataType){ - case YAHOO.ext.grid.LoadableDataModel.XML: - this.loadData(response.responseXML, cb, keepExisting, insertIndex); - break; - case YAHOO.ext.grid.LoadableDataModel.JSON: - var rtext = response.responseText; - try { // this code is a modified version of Yahoo! UI DataSource JSON parsing - // Trim leading spaces - while(rtext.substring(0,1) == " ") { - rtext = rtext.substring(1, rtext.length); - } - // Invalid JSON response - if(rtext.indexOf("{") < 0) { - throw "Invalid JSON response"; - } - - // Empty (but not invalid) JSON response - if(rtext.indexOf("{}") === 0) { - this.loadData({}, response.argument.callback); - return; - } - - // Turn the string into an object literal... - // ...eval is necessary here - var jsonObjRaw = eval("(" + rtext + ")"); - if(!jsonObjRaw) { - throw "Error evaling JSON response"; - } - this.loadData(jsonObjRaw, cb, keepExisting, insertIndex); - } catch(e) { - this.fireLoadException(e, response); - if(typeof callback == 'function'){ - callback(this, false); - } - } - break; - case YAHOO.ext.grid.LoadableDataModel.TEXT: - this.loadData(response.responseText, cb, keepExisting, insertIndex); - break; - }; -}; - -/**@private*/ -YAHOO.ext.grid.LoadableDataModel.prototype.processException = function(response){ - this.fireLoadException(null, response); - if(typeof response.argument.callback == 'function'){ - response.argument.callback(this, false); - } -}; - -YAHOO.ext.grid.LoadableDataModel.prototype.fireLoadException = function(e, responseObj){ - this.onLoadException.fireDirect(this, e, responseObj); -}; - -YAHOO.ext.grid.LoadableDataModel.prototype.fireLoadEvent = function(){ - this.fireEvent('load', this.loadedPage, this.getTotalPages()); -}; - -/** - * Adds a preprocessor function to parse data before it is added to the Model - ie. Date.parse to parse dates. - */ -YAHOO.ext.grid.LoadableDataModel.prototype.addPreprocessor = function(columnIndex, fn){ - this.preprocessors[columnIndex] = fn; -}; - -/** - * Gets the preprocessor function for the specified column. - */ -YAHOO.ext.grid.LoadableDataModel.prototype.getPreprocessor = function(columnIndex){ - return this.preprocessors[columnIndex]; -}; - -/** - * Removes a preprocessor function. - */ -YAHOO.ext.grid.LoadableDataModel.prototype.removePreprocessor = function(columnIndex){ - this.preprocessors[columnIndex] = null; -}; - -/** - * Adds a postprocessor function to format data before updating the underlying data source (ie. convert date to string before updating XML document). - */ -YAHOO.ext.grid.LoadableDataModel.prototype.addPostprocessor = function(columnIndex, fn){ - this.postprocessors[columnIndex] = fn; -}; - -/** - * Gets the postprocessor function for the specified column. - */ -YAHOO.ext.grid.LoadableDataModel.prototype.getPostprocessor = function(columnIndex){ - return this.postprocessors[columnIndex]; -}; - -/** - * Removes a postprocessor function. - */ -YAHOO.ext.grid.LoadableDataModel.prototype.removePostprocessor = function(columnIndex){ - this.postprocessors[columnIndex] = null; -}; -/** - * Empty interface method - Called to process the data returned by the XHR - Classes which extend LoadableDataModel should implement this method. - * See {@link YAHOO.ext.XMLDataModel} for an example implementation. - */ -YAHOO.ext.grid.LoadableDataModel.prototype.loadData = function(data, callback, keepExisting, insertIndex){ - -}; - -YAHOO.ext.grid.LoadableDataModel.XML = 'xml'; -YAHOO.ext.grid.LoadableDataModel.JSON = 'json'; -YAHOO.ext.grid.LoadableDataModel.TEXT = 'text'; - -/* -YAHOO.ext.grid.SparceDataset = function(bufferSize){ - this.stack = []; - this.bufferSize = bufferSize || 1000; - this.maxIndex = 0; - - this.events = { - 'rowsexpired' : new YAHOO.util.CustomEvent('rowsexpired') - }; -}; - -YAHOO.ext.grid.SparceDataset.prototype = { - addListener : YAHOO.ext.grid.Grid.prototype.addListener, - removeListener : YAHOO.ext.grid.Grid.prototype.removeListener, - fireEvent : YAHOO.ext.grid.Grid.prototype.fireEvent, - - getRowAt : function(index){ - return this[String(index)]; - }, - - splice : function(index, deleteCount){ - this.insertRowsAt(index, Array.prototype.slice.call(arguments, 2)); - }, - - concat : function(){ - this.insertRowsAt(index, Array.prototype.slice.call(arguments, 2)); - }, - - insertRowsAt: function(index, rowData){ - for(var i = 0; i < rowData.length; i++) { - var d = rowData[i]; - var dataIndex = index + i; - this[dataIndex] = d; - this.stack.push(dataIndex); - } - this.maxIndex = Math.max(this.maxIndex, index+rowData.length); - this.cleanup(); - }, - - cleanup : function(){ - while(stack.length > this.bufferSize){ - var dataIndex = stack.shift(); - delete this[dataIndex]; - this.fireEvent('rowsexpired', dataIndex); - } - } -};*/ - - - - - --
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.NumberEditor | -- |
YAHOO.ext.grid.NumberEditor = function(config){ - var element = document.createElement('input'); - element.type = 'text'; - element.className = 'ygrid-editor ygrid-num-editor'; - element.setAttribute('autocomplete', 'off'); - document.body.appendChild(element); - YAHOO.ext.grid.NumberEditor.superclass.constructor.call(this, element); - YAHOO.ext.util.Config.apply(this, config); -}; -YAHOO.extendX(YAHOO.ext.grid.NumberEditor, YAHOO.ext.grid.CellEditor); - -YAHOO.ext.grid.NumberEditor.prototype.initEvents = function(){ - var stopOnEnter = function(e){ - if(e.browserEvent.keyCode == e.RETURN){ - this.stopEditing(true); - } - }; - - var allowed = "0123456789"; - if(this.allowDecimals){ - allowed += this.decimalSeparator; - } - if(this.allowNegative){ - allowed += '-'; - } - var keyPress = function(e){ - var c = e.getCharCode(); - if(c != e.BACKSPACE && allowed.indexOf(String.fromCharCode(c)) === -1){ - e.stopEvent(); - } - }; - this.element.mon('keydown', stopOnEnter, this, true); - var vtask = new YAHOO.ext.util.DelayedTask(this.validate, this); - this.element.mon('keyup', vtask.delay.createDelegate(vtask, [this.validationDelay])); - this.element.mon('keypress', keyPress, this, true); - this.element.on('blur', this.stopEditing, this, true); -}; - -YAHOO.ext.grid.NumberEditor.prototype.validate = function(){ - var dom = this.element.dom; - var value = dom.value; - if(value.length < 1){ // if it's blank - if(this.allowBlank){ - dom.title = ''; - this.element.removeClass('ygrid-editor-invalid'); - return true; - }else{ - dom.title = this.blankText; - this.element.addClass('ygrid-editor-invalid'); - return false; - } - } - if(value.search(/\d+/) === -1){ - dom.title = this.nanText.replace('%0', value); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - var num = this.parseValue(value); - if(num < this.minValue){ - dom.title = this.minText.replace('%0', this.minValue); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - if(num > this.maxValue){ - dom.title = this.maxText.replace('%0', this.maxValue); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - var msg = this.validator(value); - if(msg !== true){ - dom.title = msg; - this.element.addClass('ygrid-editor-invalid'); - return false; - } - dom.title = ''; - this.element.removeClass('ygrid-editor-invalid'); - return true; -}; - -YAHOO.ext.grid.NumberEditor.prototype.show = function(){ - this.element.dom.title = ''; - YAHOO.ext.grid.NumberEditor.superclass.show.call(this); - if(this.selectOnFocus){ - try{ - this.element.dom.select(); - }catch(e){} - } - this.validate(this.element.dom.value); -}; - -YAHOO.ext.grid.NumberEditor.prototype.getValue = function(){ - if(!this.validate()){ - return this.originalValue; - }else{ - var value = this.element.dom.value; - if(value.length < 1){ - return value; - } else{ - return this.fixPrecision(this.parseValue(value)); - } - } -}; -YAHOO.ext.grid.NumberEditor.prototype.parseValue = function(value){ - return parseFloat(new String(value).replace(this.decimalSeparator, '.')); -}; - -YAHOO.ext.grid.NumberEditor.prototype.fixPrecision = function(value){ - if(!this.allowDecimals || this.decimalPrecision == -1 || isNaN(value) || value == 0 || !value){ - return value; - } - // this should work but doesn't due to precision error in JS - // var scale = Math.pow(10, this.decimalPrecision); - // var fixed = this.decimalPrecisionFcn(value * scale); - // return fixed / scale; - // - // so here's our workaround: - var scale = Math.pow(10, this.decimalPrecision+1); - var fixed = this.decimalPrecisionFcn(value * scale); - fixed = this.decimalPrecisionFcn(fixed/10); - return fixed / (scale/10); -}; - -YAHOO.ext.grid.NumberEditor.prototype.allowBlank = true; -YAHOO.ext.grid.NumberEditor.prototype.allowDecimals = true; -YAHOO.ext.grid.NumberEditor.prototype.decimalSeparator = '.'; -YAHOO.ext.grid.NumberEditor.prototype.decimalPrecision = 2; -YAHOO.ext.grid.NumberEditor.prototype.decimalPrecisionFcn = Math.floor; -YAHOO.ext.grid.NumberEditor.prototype.allowNegative = true; -YAHOO.ext.grid.NumberEditor.prototype.selectOnFocus = true; -YAHOO.ext.grid.NumberEditor.prototype.minValue = Number.NEGATIVE_INFINITY; -YAHOO.ext.grid.NumberEditor.prototype.maxValue = Number.MAX_VALUE; -YAHOO.ext.grid.NumberEditor.prototype.minText = 'The minimum value for this field is %0'; -YAHOO.ext.grid.NumberEditor.prototype.maxText = 'The maximum value for this field is %0'; -YAHOO.ext.grid.NumberEditor.prototype.blankText = 'This field cannot be blank'; -YAHOO.ext.grid.NumberEditor.prototype.nanText = '%0 is not a valid number'; -YAHOO.ext.grid.NumberEditor.prototype.validationDelay = 100; -YAHOO.ext.grid.NumberEditor.prototype.validator = function(){return true;};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.PagedGridView | -- |
-YAHOO.ext.grid.PagedGridView = function(){ - YAHOO.ext.grid.PagedGridView.superclass.constructor.call(this); - this.cursor = 1; -}; -YAHOO.extendX(YAHOO.ext.grid.PagedGridView, YAHOO.ext.grid.GridView); - -YAHOO.ext.grid.PagedGridView.prototype.appendFooter = function(parentEl){ - var fwrap = document.createElement('div'); - fwrap.className = 'ygrid-wrap-footer'; - var fbody = document.createElement('span'); - fbody.className = 'ygrid-footer'; - fwrap.appendChild(fbody); - parentEl.appendChild(fwrap); - this.createPagingToolbar(fbody); - return fwrap; -}; -YAHOO.ext.grid.PagedGridView.prototype.createPagingToolbar = function(container){ - var tb = new YAHOO.ext.Toolbar(container); - this.pageToolbar = tb; - this.first = tb.addButton({ - tooltip: this.firstText, - className: 'ygrid-page-first', - disabled: true, - click: this.onClick.createDelegate(this, ['first']) - }); - this.prev = tb.addButton({ - tooltip: this.prevText, - className: 'ygrid-page-prev', - disabled: true, - click: this.onClick.createDelegate(this, ['prev']) - }); - tb.addSeparator(); - tb.add(this.beforePageText); - var pageBox = document.createElement('input'); - pageBox.type = 'text'; - pageBox.size = 3; - pageBox.value = '1'; - pageBox.className = 'ygrid-page-number'; - tb.add(pageBox); - this.field = getEl(pageBox, true); - this.field.mon('keydown', this.onEnter, this, true); - this.field.on('focus', function(){pageBox.select();}); - this.afterTextEl = tb.addText(this.afterPageText.replace('%0', '1')); - this.field.setHeight(18); - tb.addSeparator(); - this.next = tb.addButton({ - tooltip: this.nextText, - className: 'ygrid-page-next', - disabled: true, - click: this.onClick.createDelegate(this, ['next']) - }); - this.last = tb.addButton({ - tooltip: this.lastText, - className: 'ygrid-page-last', - disabled: true, - click: this.onClick.createDelegate(this, ['last']) - }); - tb.addSeparator(); - this.loading = tb.addButton({ - tooltip: this.refreshText, - className: 'ygrid-loading', - disabled: true, - click: this.onClick.createDelegate(this, ['refresh']) - }); - this.onPageLoaded(1, this.grid.dataModel.getTotalPages()); -}; -YAHOO.ext.grid.PagedGridView.prototype.getPageToolbar = function(){ - return this.pageToolbar; -}; - -YAHOO.ext.grid.PagedGridView.prototype.onPageLoaded = function(pageNum, totalPages){ - this.cursor = pageNum; - this.lastPage = totalPages; - this.afterTextEl.innerHTML = this.afterPageText.replace('%0', totalPages); - this.field.dom.value = pageNum; - this.first.setDisabled(pageNum == 1); - this.prev.setDisabled(pageNum == 1); - this.next.setDisabled(pageNum == totalPages); - this.last.setDisabled(pageNum == totalPages); - this.loading.enable(); -}; - -YAHOO.ext.grid.PagedGridView.prototype.onEnter = function(e){ - if(e.browserEvent.keyCode == e.RETURN){ - var v = this.field.dom.value; - if(!v){ - this.field.dom.value = this.cursor; - return; - } - var pageNum = parseInt(v, 10); - if(isNaN(v)){ - this.field.dom.value = this.cursor; - return; - } - pageNum = Math.min(Math.max(1, pageNum), this.lastPage); - this.grid.dataModel.loadPage(pageNum); - e.stopEvent(); - } -}; - -YAHOO.ext.grid.PagedGridView.prototype.beforeLoad = function(){ - if(this.loading){ - this.loading.disable(); - } -}; - -YAHOO.ext.grid.PagedGridView.prototype.onClick = function(which){ - switch(which){ - case 'first': - this.grid.dataModel.loadPage(1); - break; - case 'prev': - this.grid.dataModel.loadPage(this.cursor -1); - break; - case 'next': - this.grid.dataModel.loadPage(this.cursor + 1); - break; - case 'last': - this.grid.dataModel.loadPage(this.lastPage); - break; - case 'refresh': - this.grid.dataModel.loadPage(this.cursor); - break; - } -}; - -YAHOO.ext.grid.PagedGridView.prototype.render = function(){ - this.grid.dataModel.addListener('beforeload', this.beforeLoad, this, true); - this.grid.dataModel.addListener('load', this.onPageLoaded, this, true); - return YAHOO.ext.grid.PagedGridView.superclass.render.call(this); -}; - -YAHOO.ext.grid.PagedGridView.prototype.beforePageText = "Page"; -YAHOO.ext.grid.PagedGridView.prototype.afterPageText = "of %0"; -YAHOO.ext.grid.PagedGridView.prototype.firstText = "First Page"; -YAHOO.ext.grid.PagedGridView.prototype.prevText = "Previous Page"; -YAHOO.ext.grid.PagedGridView.prototype.nextText = "Next Page"; -YAHOO.ext.grid.PagedGridView.prototype.lastText = "Last Page"; -YAHOO.ext.grid.PagedGridView.prototype.refreshText = "Refresh"; --
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.Resizable | -Makes an element resizable. | -
/** - * @class - * Makes an element resizable. - */ -YAHOO.ext.Resizable = function(el, config){ - // in case global fcn not defined - var getEl = YAHOO.ext.Element.get; - - this.el = getEl(el, true); - this.el.autoBoxAdjust = true; - // if the element isn't positioned, make it relative - if(this.el.getStyle('position') != 'absolute'){ - this.el.setStyle('position', 'relative'); - } - - // create the handles and proxy - var dh = YAHOO.ext.DomHelper; - var tpl = dh.createTemplate({tag: 'div', cls: 'yresizable-handle yresizable-handle-{0}', html: ' '}); - this.east = getEl(tpl.append(this.el.dom, ['east']), true); - this.south = getEl(tpl.append(this.el.dom, ['south']), true); - if(config && config.multiDirectional){ - this.west = getEl(tpl.append(this.el.dom, ['west']), true); - this.north = getEl(tpl.append(this.el.dom, ['north']), true); - } - this.corner = getEl(tpl.append(this.el.dom, ['southeast']), true); - this.proxy = getEl(dh.insertBefore(document.body.firstChild, {tag: 'div', cls: 'yresizable-proxy', id: this.el.id + '-rzproxy'}), true); - this.proxy.autoBoxAdjust = true; - - // wrapped event handlers to add and remove when sizing - this.moveHandler = YAHOO.ext.EventManager.wrap(this.onMouseMove, this, true); - this.upHandler = YAHOO.ext.EventManager.wrap(this.onMouseUp, this, true); - this.selHandler = YAHOO.ext.EventManager.wrap(this.cancelSelection, this, true); - - // public events - this.events = { - 'beforeresize' : new YAHOO.util.CustomEvent(), - 'resize' : new YAHOO.util.CustomEvent() - }; - - /** @private */ - this.dir = null; - - // properties - this.resizeChild = false; - this.adjustments = [0, 0]; - this.minWidth = 5; - this.minHeight = 5; - this.maxWidth = 10000; - this.maxHeight = 10000; - this.enabled = true; - this.animate = false; - this.duration = .35; - this.dynamic = false; - this.multiDirectional = false; - this.disableTrackOver = false; - this.easing = YAHOO.util.Easing ? YAHOO.util.Easing.easeOutStrong : null; - - YAHOO.ext.util.Config.apply(this, config); - - // listen for mouse down on the handles - var mdown = this.onMouseDown.createDelegate(this); - this.east.mon('mousedown', mdown); - this.south.mon('mousedown', mdown); - if(this.multiDirectional){ - this.west.mon('mousedown', mdown); - this.north.mon('mousedown', mdown); - } - this.corner.mon('mousedown', mdown); - - if(!this.disableTrackOver){ - // track mouse overs - var mover = this.onMouseOver.createDelegate(this); - // track mouse outs - var mout = this.onMouseOut.createDelegate(this); - - this.east.mon('mouseover', mover); - this.east.mon('mouseout', mout); - this.south.mon('mouseover', mover); - this.south.mon('mouseout', mout); - if(this.multiDirectional){ - this.west.mon('mouseover', mover); - this.west.mon('mouseout', mout); - this.north.mon('mouseover', mover); - this.north.mon('mouseout', mout); - } - this.corner.mon('mouseover', mover); - this.corner.mon('mouseout', mout); - } - this.updateChildSize(); -}; - -YAHOO.extendX(YAHOO.ext.Resizable, YAHOO.ext.util.Observable, { - resizeTo : function(width, height){ - this.el.setSize(width, height); - this.fireEvent('resize', this, width, height, null); - }, - - cancelSelection : function(e){ - e.preventDefault(); - }, - - startSizing : function(e){ - this.fireEvent('beforeresize', this, e); - if(this.enabled){ // 2nd enabled check in case disabled before beforeresize handler - e.preventDefault(); - this.startBox = this.el.getBox(); - this.startPoint = e.getXY(); - this.offsets = [(this.startBox.x + this.startBox.width) - this.startPoint[0], - (this.startBox.y + this.startBox.height) - this.startPoint[1]]; - this.proxy.setBox(this.startBox); - if(!this.dynamic){ - this.proxy.show(); - } - YAHOO.util.Event.on(document.body, 'selectstart', this.selHandler); - YAHOO.util.Event.on(document.body, 'mousemove', this.moveHandler); - YAHOO.util.Event.on(document.body, 'mouseup', this.upHandler); - } - }, - - onMouseDown : function(e){ - if(this.enabled){ - var t = e.getTarget(); - if(t == this.corner.dom){ - this.dir = 'both'; - this.proxy.setStyle('cursor', this.corner.getStyle('cursor')); - this.startSizing(e); - }else if(t == this.east.dom){ - this.dir = 'east'; - this.proxy.setStyle('cursor', this.east.getStyle('cursor')); - this.startSizing(e); - }else if(t == this.south.dom){ - this.dir = 'south'; - this.proxy.setStyle('cursor', this.south.getStyle('cursor')); - this.startSizing(e); - }else if(t == this.west.dom){ - this.dir = 'west'; - this.proxy.setStyle('cursor', this.west.getStyle('cursor')); - this.startSizing(e); - }else if(t == this.north.dom){ - this.dir = 'north'; - this.proxy.setStyle('cursor', this.north.getStyle('cursor')); - this.startSizing(e); - } - } - }, - - onMouseUp : function(e){ - YAHOO.util.Event.removeListener(document.body, 'selectstart', this.selHandler); - YAHOO.util.Event.removeListener(document.body, 'mousemove', this.moveHandler); - YAHOO.util.Event.removeListener(document.body, 'mouseup', this.upHandler); - var size = this.resizeElement(); - this.fireEvent('resize', this, size.width, size.height, e); - }, - - updateChildSize : function(){ - if(this.resizeChild && this.el.dom.firstChild && this.el.dom.offsetWidth){ - var el = this.el; - var adj = this.adjustments; - setTimeout(function(){ - var c = YAHOO.ext.Element.get(el.dom.firstChild, true); - var b = el.getBox(true); - c.setSize(b.width+adj[0], b.height+adj[1]); - }, 1); - } - }, - - resizeElement : function(){ - var box = this.proxy.getBox(); - this.el.setBox(box, false, this.animate, this.duration, null, this.easing); - this.updateChildSize(); - this.proxy.hide(); - return box; - }, - - onMouseMove : function(e){ - if(this.enabled){ - var xy = e.getXY(); - if(this.dir == 'both' || this.dir == 'east' || this.dir == 'south'){ - var w = Math.min(Math.max(this.minWidth, xy[0]-this.startBox.x+this.offsets[0]),this.maxWidth); - var h = Math.min(Math.max(this.minHeight, xy[1]-this.startBox.y+this.offsets[1]), this.maxHeight); - if(this.dir == 'both'){ - this.proxy.setSize(w, h); - }else if(this.dir == 'east'){ - this.proxy.setWidth(w); - }else if(this.dir == 'south'){ - this.proxy.setHeight(h); - } - }else{ - var x = this.startBox.x + (xy[0]-this.startPoint[0]); - var y = this.startBox.y + (xy[1]-this.startPoint[1]); - var w = this.startBox.width+(this.startBox.x-x); - var h = this.startBox.height+(this.startBox.y-y); - if(this.dir == 'west' && w <= this.maxWidth && w >= this.minWidth){ - this.proxy.setX(x); - this.proxy.setWidth(w); - }else if(this.dir == 'north' && h <= this.maxHeight && h >= this.minHeight){ - this.proxy.setY(y); - this.proxy.setHeight(h); - } - } - if(this.dynamic){ - this.resizeElement(); - } - } - }, - - onMouseOver : function(){ - if(this.enabled) this.el.addClass('yresizable-over'); - }, - - onMouseOut : function(){ - this.el.removeClass('yresizable-over'); - } -});-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.SelectEditor | -- |
YAHOO.ext.grid.SelectEditor = function(element){ - element.hideFocus = true; - YAHOO.ext.grid.SelectEditor.superclass.constructor.call(this, element); -}; -YAHOO.extendX(YAHOO.ext.grid.SelectEditor, YAHOO.ext.grid.CellEditor); - -YAHOO.ext.grid.SelectEditor.prototype.fitToCell = function(box){ - if(YAHOO.ext.util.Browser.isGecko){ - box.height -= 3; - } - this.element.setBox(box, true); -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.DefaultSelectionModel | -The default SelectionModel used by YAHOO.ext.grid.Grid. | -
| YAHOO.ext.grid.DisableSelectionModel | -Extends YAHOO.ext.grid.DefaultSelectionModel to disable row selection. | -
| YAHOO.ext.grid.SingleSelectionModel | -Extends YAHOO.ext.grid.DefaultSelectionModel to allow only one row to be selected at a time. | -
/** - @class The default SelectionModel used by {@link YAHOO.ext.grid.Grid}. - It supports multiple selections and keyboard selection/navigation. <br><br> - @constructor - */ -YAHOO.ext.grid.DefaultSelectionModel = function(){ - /** @private */ - this.selectedRows = []; - /** @private */ - this.selectedRowIds = []; - /** @private */ - this.lastSelectedRow = null; - - /** Fires when a row is selected or deselected - fireDirect sig: (this, row, isSelected) - * @type YAHOO.util.CustomEvent - * @deprecated - */ - this.onRowSelect = new YAHOO.util.CustomEvent('SelectionTable.rowSelected'); - /** Fires when the selection changes on the Grid - fireDirect sig: (this, selectedRows[], selectedRowIds[]) - * @type YAHOO.util.CustomEvent - * @deprecated - */ - this.onSelectionChange = new YAHOO.util.CustomEvent('SelectionTable.selectionChanged'); - - this.events = { - 'selectionchange' : this.onSelectionChange, - 'rowselect' : this.onRowSelect - }; - - this.locked = false; -}; - -YAHOO.ext.grid.DefaultSelectionModel.prototype = { - /** @ignore Called by the grid automatically. Do not call directly. */ - init : function(grid){ - this.grid = grid; - this.initEvents(); - }, - - lock : function(){ - this.locked = true; - }, - - unlock : function(){ - this.locked = false; - }, - - isLocked : function(){ - return this.locked; - }, - - /** @ignore */ - initEvents : function(){ - if(this.grid.trackMouseOver){ - this.grid.addListener("mouseover", this.handleOver, this, true); - this.grid.addListener("mouseout", this.handleOut, this, true); - } - this.grid.addListener("rowclick", this.rowClick, this, true); - this.grid.addListener("keydown", this.keyDown, this, true); - }, - - addListener : YAHOO.ext.grid.Grid.prototype.addListener, - removeListener : YAHOO.ext.grid.Grid.prototype.removeListener, - fireEvent : YAHOO.ext.grid.Grid.prototype.fireEvent, - - /** @ignore Syncs selectedRows with the correct row by looking it up by id. - Used after a sort moves data around. */ - syncSelectionsToIds : function(){ - if(this.getCount() > 0){ - var ids = this.selectedRowIds.concat(); - this.clearSelections(); - this.selectRowsById(ids, true); - } - }, - - /** - * Set the selected rows by their ID(s). IDs must match what is returned by the DataModel getRowId(index). - * @param {String/Array} id The id(s) to select - * @param {<i>Boolean</i>} keepExisting (optional) True to retain existing selections - */ - selectRowsById : function(id, keepExisting){ - var rows = this.grid.getRowsById(id); - this.selectRows(rows, keepExisting); - }, - - /** - * Gets the number of selected rows. - * @return {Number} - */ - getCount : function(){ - return this.selectedRows.length; - }, - - /** - * Selects the first row in the grid. - */ - selectFirstRow : function(){ - for(var j = 0; j < this.grid.rows.length; j++){ - if(this.isSelectable(this.grid.rows[j])){ - this.focusRow(this.grid.rows[j]); - this.setRowState(this.grid.rows[j], true); - return; - } - } - }, - - /** - * Selects the row immediately following the last selected row. - * @param {<i>Boolean</i>} keepExisting (optional) True to retain existing selections - */ - selectNext : function(keepExisting){ - if(this.lastSelectedRow){ - for(var j = (this.lastSelectedRow.rowIndex+1); j < this.grid.rows.length; j++){ - var row = this.grid.rows[j]; - if(this.isSelectable(row)){ - this.focusRow(row); - this.setRowState(row, true, keepExisting); - return; - } - } - } - }, - - /** - * Selects the row that precedes the last selected row. - * @param {<i>Boolean</i>} keepExisting (optional) True to retain existing selections - */ - selectPrevious : function(keepExisting){ - if(this.lastSelectedRow){ - for(var j = (this.lastSelectedRow.rowIndex-1); j >= 0; j--){ - var row = this.grid.rows[j]; - if(this.isSelectable(row)){ - this.focusRow(row); - this.setRowState(row, true, keepExisting); - return; - } - } - } - }, - - /** - * Returns the selected rows. - * @return {Array} Array of DOM row elements - */ - getSelectedRows : function(){ - return this.selectedRows; - }, - - /** - * Returns the selected row ids. - * @return {Array} Array of String ids - */ - getSelectedRowIds : function(){ - return this.selectedRowIds; - }, - - /** - * Clears all selections. - */ - clearSelections : function(){ - if(this.isLocked()) return; - var oldSelections = this.selectedRows.concat(); - for(var j = 0; j < oldSelections.length; j++){ - this.setRowState(oldSelections[j], false); - } - this.selectedRows = []; - this.selectedRowIds = []; - }, - - - /** - * Selects all rows. - */ - selectAll : function(){ - if(this.isLocked()) return; - for(var j = 0; j < this.grid.rows.length; j++){ - this.setRowState(this.grid.rows[j], true, true); - } - }, - - /** - * Returns True if there is a selection. - * @return {Boolean} - */ - hasSelection : function(){ - return this.selectedRows.length > 0; - }, - - /** - * Returns True if the specified row is selected. - * @param {HTMLElement} row The row to check - * @return {Boolean} - */ - isSelected : function(row){ - return row && (row.selected === true || row.getAttribute('selected') == 'true'); - }, - - /** - * Returns True if the specified row is selectable. - * @param {HTMLElement} row The row to check - * @return {Boolean} - */ - isSelectable : function(row){ - return row && row.getAttribute('selectable') != 'false'; - }, - - /** @ignore */ - rowClick : function(grid, rowIndex, e){ - if(this.isLocked()) return; - var row = grid.getRow(rowIndex); - if(this.isSelectable(row)){ - if(e.shiftKey && this.lastSelectedRow){ - var lastIndex = this.lastSelectedRow.rowIndex; - this.selectRange(this.lastSelectedRow, row, e.ctrlKey); - this.lastSelectedRow = this.grid.el.dom.rows[lastIndex]; - }else{ - this.focusRow(row); - var rowState = e.ctrlKey ? !this.isSelected(row) : true; - this.setRowState(row, rowState, e.hasModifier()); - } - } - }, - - /** - * Deprecated. Tries to focus the row and scroll it into view - Use grid.scrollTo or grid.getView().focusRow() instead. - * @deprecated - * @param {HTMLElement} row The row to focus - */ - focusRow : function(row){ - this.grid.view.focusRow(row); - }, - - /** - * Selects a row. - * @param {Number/HTMLElement} row The row or index of the row to select - * @param {<i>Boolean</i>} keepExisting (optional) True to retain existing selections - */ - selectRow : function(row, keepExisting){ - this.setRowState(this.getRow(row), true, keepExisting); - }, - - /** - * Selects multiple rows. - * @param {Array} rows Array of the rows or indexes of the row to select - * @param {<i>Boolean</i>} keepExisting (optional) True to retain existing selections - */ - selectRows : function(rows, keepExisting){ - if(!keepExisting){ - this.clearSelections(); - } - for(var i = 0; i < rows.length; i++){ - this.selectRow(rows[i], true); - } - }, - - /** - * Deselects a row. - * @param {Number/HTMLElement} row The row or index of the row to deselect - */ - deselectRow : function(row){ - this.setRowState(this.getRow(row), false); - }, - - /** @ignore */ - getRow : function(row){ - if(typeof row == 'number'){ - row = this.grid.rows[row]; - } - return row; - }, - - /** - * Selects a range of rows. All rows in between startRow and endRow are also selected. - * @param {Number/HTMLElement} startRow The row or index of the first row in the range - * @param {Number/HTMLElement} endRow The row or index of the last row in the range - * @param {<i>Boolean</i>} keepExisting (optional) True to retain existing selections - */ - selectRange : function(startRow, endRow, keepExisting){ - startRow = this.getRow(startRow); - endRow = this.getRow(endRow); - this.setRangeState(startRow, endRow, true, keepExisting); - }, - - /** - * Deselects a range of rows. All rows in between startRow and endRow are also deselected. - * @param {Number/HTMLElement} startRow The row or index of the first row in the range - * @param {Number/HTMLElement} endRow The row or index of the last row in the range - */ - deselectRange : function(startRow, endRow){ - startRow = this.getRow(startRow); - endRow = this.getRow(endRow); - this.setRangeState(startRow, endRow, false, true); - }, - - /** @ignore */ - setRowStateFromChild : function(childEl, selected, keepExisting){ - var row = this.grid.getRowFromChild(childEl); - this.setRowState(row, selected, keepExisting); - }, - - /** @ignore */ - setRangeState : function(startRow, endRow, selected, keepExisting){ - if(this.isLocked()) return; - if(!keepExisting){ - this.clearSelections(); - } - var curRow = startRow; - while(curRow.rowIndex != endRow.rowIndex){ - this.setRowState(curRow, selected, true); - curRow = (startRow.rowIndex < endRow.rowIndex ? - this.grid.getRowAfter(curRow) : this.grid.getRowBefore(curRow)) - } - this.setRowState(endRow, selected, true); - }, - - /** @ignore */ - setRowState : function(row, selected, keepExisting){ - if(this.isLocked()) return; - if(this.isSelectable(row)){ - if(selected){ - if(!keepExisting){ - this.clearSelections(); - } - this.setRowClass(row, 'selected'); - row.selected = true; - this.selectedRows.push(row); - this.selectedRowIds.push(this.grid.dataModel.getRowId(row.rowIndex)); - this.lastSelectedRow = row; - }else{ - this.setRowClass(row, ''); - row.selected = false; - this._removeSelected(row); - } - this.fireEvent('rowselect', this, row, selected); - this.fireEvent('selectionchange', this, this.selectedRows, this.selectedRowIds); - } - }, - - /** @ignore */ - handleOver : function(e){ - var row = this.grid.getRowFromChild(e.getTarget()); - if(this.isSelectable(row) && !this.isSelected(row)){ - this.setRowClass(row, 'over'); - } - }, - - /** @ignore */ - handleOut : function(e){ - var row = this.grid.getRowFromChild(e.getTarget()); - if(this.isSelectable(row) && !this.isSelected(row)){ - this.setRowClass(row, ''); - } - }, - - /** @ignore */ - keyDown : function(e){ - if(e.browserEvent.keyCode == e.DOWN){ - this.selectNext(e.shiftKey); - e.preventDefault(); - }else if(e.browserEvent.keyCode == e.UP){ - this.selectPrevious(e.shiftKey); - e.preventDefault(); - } - }, - - /** @ignore */ - setRowClass : function(row, cssClass){ - if(this.isSelectable(row)){ - if(cssClass == 'selected'){ - YAHOO.util.Dom.removeClass(row, 'ygrid-row-over'); - YAHOO.util.Dom.addClass(row, 'ygrid-row-selected'); - }else if(cssClass == 'over'){ - YAHOO.util.Dom.removeClass(row, 'ygrid-row-selected'); - YAHOO.util.Dom.addClass(row, 'ygrid-row-over'); - }else if(cssClass == ''){ - YAHOO.util.Dom.removeClass(row, 'ygrid-row-selected'); - YAHOO.util.Dom.removeClass(row, 'ygrid-row-over'); - } - } - }, - - /** @ignore */ - _removeSelected : function(row){ - var sr = this.selectedRows; - for (var i = 0; i < sr.length; i++) { - if (sr[i] === row){ - this.selectedRows.splice(i, 1); - this.selectedRowIds.splice(i, 1); - return; - } - } - } -}; - -/** - @class Extends {@link YAHOO.ext.grid.DefaultSelectionModel} to allow only one row to be selected at a time. <br><br> - @extends YAHOO.ext.grid.DefaultSelectionModel - @constructor - */ -YAHOO.ext.grid.SingleSelectionModel = function(){ - YAHOO.ext.grid.SingleSelectionModel.superclass.constructor.call(this); -}; - -YAHOO.extendX(YAHOO.ext.grid.SingleSelectionModel, YAHOO.ext.grid.DefaultSelectionModel); - -/** @ignore */ -YAHOO.ext.grid.SingleSelectionModel.prototype.setRowState = function(row, selected){ - YAHOO.ext.grid.SingleSelectionModel.superclass.setRowState.call(this, row, selected, false); -}; - -/** - @class Extends {@link YAHOO.ext.grid.DefaultSelectionModel} to disable row selection. <br><br> - @extends YAHOO.ext.grid.DefaultSelectionModel - @constructor - */ -YAHOO.ext.grid.DisableSelectionModel = function(){ - YAHOO.ext.grid.DisableSelectionModel.superclass.constructor.call(this); -}; - -YAHOO.extendX(YAHOO.ext.grid.DisableSelectionModel, YAHOO.ext.grid.DefaultSelectionModel); - -YAHOO.ext.grid.DisableSelectionModel.prototype.initEvents = function(){ -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.SplitBar | -Creates draggable splitter bar functionality from two elements. | -
| YAHOO.ext.SplitBar.AbsoluteLayoutAdapter | -Adapter that moves the splitter element to align with the resized sizing element. | -
| YAHOO.ext.SplitBar.BasicLayoutAdapter | -Default Adapter. | -
/* - * splitbar.js, version .7 - * Copyright(c) 2006, Jack Slocum. - * Code licensed under the BSD License - */ - -YAHOO.util.DragDropMgr.clickTimeThresh = 350; - -/** - * @class Creates draggable splitter bar functionality from two elements. - * <br><br> - * Usage: - * <pre><code> - * var split = new YAHOO.ext.SplitBar('elementToDrag', 'elementToSize', - * YAHOO.ext.SplitBar.HORIZONTAL, YAHOO.ext.SplitBar.LEFT); - * split.setAdapter(new YAHOO.ext.SplitBar.AbsoluteLayoutAdapter("container")); - * split.minSize = 100; - * split.maxSize = 600; - * split.animate = true; - * split.onMoved.subscribe(splitterMoved); - * </code></pre> - * @requires YAHOO.ext.Element - * @requires YAHOO.util.Dom - * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent - * @requires YAHOO.util.DDProxy - * @requires YAHOO.util.Anim (optional) to support animation - * @requires YAHOO.util.Easing (optional) to support animation - * @constructor - * @param {String/HTMLElement/Element} dragElement The element to be dragged and act as the SplitBar. - * @param {String/HTMLElement/Element} resizingElement The element to be resized based on where the SplitBar element is dragged - * @param {Number} orientation (optional) Either YAHOO.ext.SplitBar.HORIZONTAL or YAHOO.ext.SplitBar.VERTICAL. (Defaults to HORIZONTAL) - * @param {Number} placement (optional) Either YAHOO.ext.SplitBar.LEFT or YAHOO.ext.SplitBar.RIGHT for horizontal or - YAHOO.ext.SplitBar.TOP or YAHOO.ext.SplitBar.BOTTOM for vertical. (By default, this is determined automatically by the intial position - position of the SplitBar). - */ -YAHOO.ext.SplitBar = function(dragElement, resizingElement, orientation, placement){ - - /** @private */ - this.el = YAHOO.ext.Element.get(dragElement, true); - - /** @private */ - this.resizingEl = YAHOO.ext.Element.get(resizingElement, true); - - /** - * @private - * The orientation of the split. Either YAHOO.ext.SplitBar.HORIZONTAL or YAHOO.ext.SplitBar.VERTICAL. (Defaults to HORIZONTAL) - * Note: If this is changed after creating the SplitBar, the placement property must be manually updated - * @type Number - */ - this.orientation = orientation || YAHOO.ext.SplitBar.HORIZONTAL; - - /** - * The minimum size of the resizing element. (Defaults to 0) - * @type Number - */ - this.minSize = 0; - - /** - * The maximum size of the resizing element. (Defaults to 2000) - * @type Number - */ - this.maxSize = 2000; - - /** - * Fires when the SplitBar is moved. Uses fireDirect with signature: (this, newSize) - * @type CustomEvent - */ - this.onMoved = new YAHOO.util.CustomEvent("SplitBarMoved", this); - - /** - * Whether to animate the transition to the new size - * @type Boolean - */ - this.animate = false; - - /** - * Whether to create a transparent shim that overlays the page when dragging, enables dragging across iframes. - * @type Boolean - */ - this.useShim = false; - - /** @private */ - this.shim = null; - - /** @private */ - this.proxy = YAHOO.ext.SplitBar.createProxy(this.orientation); - - /** @private */ - this.dd = new YAHOO.util.DDProxy(this.el.dom.id, "SplitBars", {dragElId : this.proxy.id}); - - /** @private */ - this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this); - - /** @private */ - this.dd.endDrag = this.onEndProxyDrag.createDelegate(this); - - /** @private */ - this.dragSpecs = {}; - - /** - * @private The adapter to use to positon and resize elements - */ - this.adapter = new YAHOO.ext.SplitBar.BasicLayoutAdapter(); - this.adapter.init(this); - - if(this.orientation == YAHOO.ext.SplitBar.HORIZONTAL){ - /** @private */ - this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? YAHOO.ext.SplitBar.LEFT : YAHOO.ext.SplitBar.RIGHT); - this.el.setStyle('cursor', 'e-resize'); - }else{ - /** @private */ - this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? YAHOO.ext.SplitBar.TOP : YAHOO.ext.SplitBar.BOTTOM); - this.el.setStyle('cursor', 'n-resize'); - } -} - -YAHOO.ext.SplitBar.prototype = { - /** - * @private Called before drag operation begins by the DDProxy - */ - onStartProxyDrag : function(x, y){ - if(this.useShim){ - if(!this.shim){ - this.shim = YAHOO.ext.SplitBar.createShim(); - } - this.shim.setVisible(true); - } - YAHOO.util.Dom.setStyle(this.proxy, 'display', 'block'); - var size = this.adapter.getElementSize(this); - var c1 = size - this.minSize; - var c2 = Math.max(this.maxSize - size, 0); - if(this.orientation == YAHOO.ext.SplitBar.HORIZONTAL){ - this.dd.resetConstraints(); - this.dd.setXConstraint( - this.placement == YAHOO.ext.SplitBar.LEFT ? c1 : c2, - this.placement == YAHOO.ext.SplitBar.LEFT ? c2 : c1 - ); - this.dd.setYConstraint(0, 0); - }else{ - this.dd.resetConstraints(); - this.dd.setXConstraint(0, 0); - this.dd.setYConstraint( - this.placement == YAHOO.ext.SplitBar.TOP ? c1 : c2, - this.placement == YAHOO.ext.SplitBar.TOP ? c2 : c1 - ); - } - this.dragSpecs.startSize = size; - this.dragSpecs.startPoint = [x, y]; - - YAHOO.util.DDProxy.prototype.b4StartDrag.call(this.dd, x, y); - }, - - /** - * @private Called after the drag operation by the DDProxy - */ - onEndProxyDrag : function(e){ - YAHOO.util.Dom.setStyle(this.proxy, 'display', 'none'); - var endPoint = YAHOO.util.Event.getXY(e); - if(this.useShim){ - this.shim.setVisible(false); - } - var newSize; - if(this.orientation == YAHOO.ext.SplitBar.HORIZONTAL){ - newSize = this.dragSpecs.startSize + - (this.placement == YAHOO.ext.SplitBar.LEFT ? - endPoint[0] - this.dragSpecs.startPoint[0] : - this.dragSpecs.startPoint[0] - endPoint[0] - ); - }else{ - newSize = this.dragSpecs.startSize + - (this.placement == YAHOO.ext.SplitBar.TOP ? - endPoint[1] - this.dragSpecs.startPoint[1] : - this.dragSpecs.startPoint[1] - endPoint[1] - ); - } - newSize = Math.min(Math.max(newSize, this.minSize), this.maxSize); - if(newSize != this.dragSpecs.startSize){ - this.adapter.setElementSize(this, newSize); - this.onMoved.fireDirect(this, newSize); - } - }, - - /** - * Get the adapter this SplitBar uses - * @return The adapter object - */ - getAdapter : function(){ - return this.adapter; - }, - - /** - * Set the adapter this SplitBar uses - * @param {Object} adapter A SplitBar adapter object - */ - setAdapter : function(adapter){ - this.adapter = adapter; - this.adapter.init(this); - }, - - /** - * Gets the minimum size for the resizing element - * @return {Number} The minimum size - */ - getMinimumSize : function(){ - return this.minSize; - }, - - /** - * Sets the minimum size for the resizing element - * @param {Number} minSize The minimum size - */ - setMinimumSize : function(minSize){ - this.minSize = minSize; - }, - - /** - * Gets the maximum size for the resizing element - * @return {Number} The maximum size - */ - getMaximumSize : function(){ - return this.maxSize; - }, - - /** - * Sets the maximum size for the resizing element - * @param {Number} maxSize The maximum size - */ - setMaximumSize : function(maxSize){ - this.maxSize = maxSize; - }, - - /** - * Sets the initialize size for the resizing element - * @param {Number} size The initial size - */ - setCurrentSize : function(size){ - var oldAnimate = this.animate; - this.animate = false; - this.adapter.setElementSize(this, size); - this.animate = oldAnimate; - } -}; - -/** - * @private static Create the shim to drag over iframes - */ -YAHOO.ext.SplitBar.createShim = function(){ - var shim = document.createElement('div'); - YAHOO.util.Dom.generateId(shim, 'split-shim'); - YAHOO.util.Dom.setStyle(shim, 'width', '100%'); - YAHOO.util.Dom.setStyle(shim, 'height', '100%'); - YAHOO.util.Dom.setStyle(shim, 'position', 'absolute'); - YAHOO.util.Dom.setStyle(shim, 'background', 'white'); - YAHOO.util.Dom.setStyle(shim, 'visibility', 'hidden'); - YAHOO.util.Dom.setStyle(shim, 'z-index', 2); - window.document.body.appendChild(shim); - var shimEl = YAHOO.ext.Element.get(shim); - shimEl.setOpacity(.01); - shimEl.setXY([0, 0]); - return shimEl; -} - -/** - * @private static Create our own proxy element element. So it will be the same same size on all browsers, we won't use borders. Instead we use a background color. - */ -YAHOO.ext.SplitBar.createProxy = function(orientation){ - var proxy = document.createElement('div'); - YAHOO.util.Dom.generateId(proxy, 'split-proxy'); - YAHOO.util.Dom.setStyle(proxy, 'position', 'absolute'); - YAHOO.util.Dom.setStyle(proxy, 'visibility', 'hidden'); - YAHOO.util.Dom.setStyle(proxy, 'z-index', 999); - YAHOO.util.Dom.setStyle(proxy, 'background-color', "#aaa"); - if(orientation == YAHOO.ext.SplitBar.HORIZONTAL){ - YAHOO.util.Dom.setStyle(proxy, 'cursor', 'e-resize'); - }else{ - YAHOO.util.Dom.setStyle(proxy, 'cursor', 'n-resize'); - } - // the next 2 fix IE abs position div height problem - YAHOO.util.Dom.setStyle(proxy, 'line-height', '0px'); - YAHOO.util.Dom.setStyle(proxy, 'font-size', '0px'); - window.document.body.appendChild(proxy); - return proxy; -} - -/** - * @class - * Default Adapter. It assumes the splitter and resizing element are not positioned - * elements and only gets/sets the width of the element. Generally used for table based layouts. - */ -YAHOO.ext.SplitBar.BasicLayoutAdapter = function(){ -} - -YAHOO.ext.SplitBar.BasicLayoutAdapter.prototype = { - // do nothing for now - init : function(s){ - - }, - /** - * Called before drag operations to get the current size of the resizing element. - * @param {YAHOO.ext.SplitBar} s The SplitBar using this adapter - */ - getElementSize : function(s){ - if(s.orientation == YAHOO.ext.SplitBar.HORIZONTAL){ - return s.resizingEl.getWidth(); - }else{ - return s.resizingEl.getHeight(); - } - }, - - /** - * Called after drag operations to set the size of the resizing element. - * @param {YAHOO.ext.SplitBar} s The SplitBar using this adapter - * @param {Number} newSize The new size to set - * @param {Function} onComplete A function to be invoke when resizing is complete - */ - setElementSize : function(s, newSize, onComplete){ - if(s.orientation == YAHOO.ext.SplitBar.HORIZONTAL){ - if(!YAHOO.util.Anim || !s.animate){ - s.resizingEl.setWidth(newSize); - if(onComplete){ - onComplete(s, newSize); - } - }else{ - s.resizingEl.setWidth(newSize, true, .1, onComplete, YAHOO.util.Easing.easeOut); - } - }else{ - - if(!YAHOO.util.Anim || !s.animate){ - s.resizingEl.setHeight(newSize); - if(onComplete){ - onComplete(s, newSize); - } - }else{ - s.resizingEl.setHeight(newSize, true, .1, onComplete, YAHOO.util.Easing.easeOut); - } - } - } -}; - -/** - *@class - * Adapter that moves the splitter element to align with the resized sizing element. - * Used with an absolute positioned SplitBar. - * @param {String/HTMLElement/Element} container The container that wraps around the absolute positioned content. If it's - * document.body, make sure you assign an id to the body element. - */ -YAHOO.ext.SplitBar.AbsoluteLayoutAdapter = function(container){ - this.basic = new YAHOO.ext.SplitBar.BasicLayoutAdapter(); - this.container = getEl(container); -} - -YAHOO.ext.SplitBar.AbsoluteLayoutAdapter.prototype = { - init : function(s){ - this.basic.init(s); - //YAHOO.util.Event.on(window, 'resize', this.moveSplitter.createDelegate(this, [s])); - }, - - getElementSize : function(s){ - return this.basic.getElementSize(s); - }, - - setElementSize : function(s, newSize, onComplete){ - this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s])); - }, - - moveSplitter : function(s){ - var yes = YAHOO.ext.SplitBar; - switch(s.placement){ - case yes.LEFT: - s.el.setX(s.resizingEl.getRight()); - break; - case yes.RIGHT: - s.el.setStyle('right', (this.container.getWidth() - s.resizingEl.getLeft()) + 'px'); - break; - case yes.TOP: - s.el.setY(s.resizingEl.getBottom()); - break; - case yes.BOTTOM: - s.el.setY(s.resizingEl.getTop() - s.el.getHeight()); - break; - } - } -}; - -/** - * Orientation constant - Create a vertical SplitBar - * @type Number - */ -YAHOO.ext.SplitBar.VERTICAL = 1; - -/** - * Orientation constant - Create a horizontal SplitBar - * @type Number - */ -YAHOO.ext.SplitBar.HORIZONTAL = 2; - -/** - * Placement constant - The resizing element is to the left of the splitter element - * @type Number - */ -YAHOO.ext.SplitBar.LEFT = 1; - -/** - * Placement constant - The resizing element is to the right of the splitter element - * @type Number - */ -YAHOO.ext.SplitBar.RIGHT = 2; - -/** - * Placement constant - The resizing element is positioned above the splitter element - * @type Number - */ -YAHOO.ext.SplitBar.TOP = 3; - -/** - * Placement constant - The resizing element is positioned under splitter element - * @type Number - */ -YAHOO.ext.SplitBar.BOTTOM = 4; --
- - - -
- - - - - - - - -YAHOO.namespace('ext.state'); - -YAHOO.ext.state.Provider = function(){ - YAHOO.ext.state.Provider.superclass.constructor.call(this); - this.events = { - 'statechange': new YAHOO.util.CustomEvent('statechange') - }; - this.state = {}; -}; -YAHOO.extendX(YAHOO.ext.state.Provider, YAHOO.ext.util.Observable, { - get : function(name){ - return this.state[name]; - }, - - clear : function(name){ - delete this.state[name]; - this.fireEvent('statechange', this, name, null); - }, - - set : function(name, value){ - this.state[name] = value; - this.fireEvent('statechange', this, name, value); - } -}); - -YAHOO.ext.state.Manager = new function(){ - var provider = new YAHOO.ext.state.Provider(); - - return { - setProvider : function(stateProvider){ - provider = stateProvider; - }, - - get : function(key){ - return provider.get(key); - }, - - set : function(key, value){ - provider.set(key, value); - }, - - clear : function(key){ - provider.clear(key); - }, - - getProvider : function(){ - return provider; - } - }; -}(); - -YAHOO.ext.state.CookieProvider = function(config){ - YAHOO.ext.state.CookieProvider.superclass.constructor.call(this); - this.path = '/'; - this.expires = new Date(new Date().getTime()+(1000*60*60*24*7)); //7 days - this.domain = null; - this.secure = false; - YAHOO.ext.util.Config.apply(this, config); - this.state = this.readCookies(); -}; - -YAHOO.extendX(YAHOO.ext.state.CookieProvider, YAHOO.ext.state.Provider, { - set : function(name, value){ - if(typeof value == 'undefined' || value === null){ - this.clear(name); - return; - } - this.setCookie(name, value); - YAHOO.ext.state.CookieProvider.superclass.set.call(this, name, value); - }, - - clear : function(name){ - this.clearCookie(name); - YAHOO.ext.state.CookieProvider.superclass.clear.call(this, name); - }, - - readCookies : function(){ - var cookies = {}; - var c = document.cookie + ';'; - var re = /\s?(.*?)=(.*?);/g; - var matches; - while((matches = re.exec(c)) != null){ - var name = matches[1]; - var value = matches[2]; - if(name && name.substring(0,3) == 'ys-'){ - cookies[name.substr(3)] = this.decodeValue(value); - } - } - return cookies; - }, - - decodeValue : function(cookie){ - var re = /^(a|n|d|b|s|o)\:(.*)$/; - var matches = re.exec(unescape(cookie)); - if(!matches || !matches[1]) return; // non state cookie - var type = matches[1]; - var v = matches[2]; - switch(type){ - case 'n': - return parseFloat(v); - case 'd': - return new Date(Date.parse(v)); - case 'b': - return (v == '1'); - case 'a': - var all = []; - var values = v.split('^'); - for(var i = 0, len = values.length; i < len; i++){ - all.push(this.decodeValue(values[i])) - } - return all; - case 'o': - var all = {}; - var values = v.split('^'); - for(var i = 0, len = values.length; i < len; i++){ - var kv = values[i].split('='); - all[kv[0]] = this.decodeValue(kv[1]); - } - return all; - default: - return v; - } - }, - - encodeValue : function(v){ - var enc; - if(typeof v == 'number'){ - enc = 'n:' + v; - }else if(typeof v == 'boolean'){ - enc = 'b:' + (v ? '1' : '0'); - }else if(v instanceof Date){ - enc = 'd:' + v.toGMTString(); - }else if(v instanceof Array){ - var flat = ''; - for(var i = 0, len = v.length; i < len; i++){ - flat += this.encodeValue(v[i]); - if(i != len-1) flat += '^'; - } - enc = 'a:' + flat; - }else if(typeof v == 'object'){ - var flat = ''; - for(var key in v){ - if(typeof v[key] != 'function'){ - flat += key + '=' + this.encodeValue(v[key]) + '^'; - } - } - enc = 'o:' + flat.substring(0, flat.length-1); - }else{ - enc = 's:' + v; - } - return escape(enc); - }, - - setCookie : function(name, value){ - document.cookie = "ys-"+ name + "=" + this.encodeValue(value) + - ((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) + - ((this.path == null) ? "" : ("; path=" + this.path)) + - ((this.domain == null) ? "" : ("; domain=" + this.domain)) + - ((this.secure == true) ? "; secure" : ""); - }, - - clearCookie : function(name){ - document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" + - ((this.path == null) ? "" : ("; path=" + this.path)) + - ((this.domain == null) ? "" : ("; domain=" + this.domain)) + - ((this.secure == true) ? "; secure" : ""); - } -}); --
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.TabPanel | -Creates a lightweight TabPanel component using Yahoo! | -
| YAHOO.ext.TabPanelItem | -- |
/* - tabpanel.js, version .1 - Copyright(c) 2006, Jack Slocum. - Code licensed under the BSD License -*/ - -/** - * @class Creates a lightweight TabPanel component using Yahoo! UI. - * <br><br> - * Usage: - * <pre><code> - <font color="#008000">// basic tabs 1, built from existing content</font> - var tabs = new YAHOO.ext.TabPanel('tabs1'); - tabs.addTab('script', "View Script"); - tabs.addTab('markup', "View Markup"); - tabs.activate('script'); - - <font color="#008000">// more advanced tabs, built from javascript</font> - var jtabs = new YAHOO.ext.TabPanel('jtabs'); - jtabs.addTab('jtabs-1', "Normal Tab", "My content was added during construction."); - - <font color="#008000">// set up the UpdateManager</font> - var tab2 = jtabs.addTab('jtabs-2', "Ajax Tab 1"); - var updater = tab2.getUpdateManager(); - updater.setDefaultUrl('ajax1.htm'); - tab2.onActivate.subscribe(updater.refresh, updater, true); - - <font color="#008000">// Use setUrl for Ajax loading</font> - var tab3 = jtabs.addTab('jtabs-3', "Ajax Tab 2"); - tab3.setUrl('ajax2.htm', null, true); - - <font color="#008000">// Disabled tab</font> - var tab4 = jtabs.addTab('tabs1-5', "Disabled Tab", "Can't see me cause I'm disabled"); - tab4.disable(); - - jtabs.activate('jtabs-1'); -} - * </code></pre> - * @requires YAHOO.ext.Element - * @requires YAHOO.ext.UpdateManager - * @requires YAHOO.util.Dom - * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent - * @requires YAHOO.util.DDProxy - * @requires YAHOO.util.Connect (optional) - * @constructor - * Create new TabPanel. - * @param {String/HTMLElement/Element} container The id, DOM element or YAHOO.ext.Element container where this TabPanel is to be rendered. - */ -YAHOO.ext.TabPanel = function(container){ - /** - * The container element for this TabPanel. - * @type YAHOO.ext.Element - */ - this.el = getEl(container); - /** @private */ - this.stripWrap = getEl(this.createStrip(this.el.dom)); - /** @private */ - this.stripEl = getEl(this.createStripList(this.stripWrap.dom)); - /** The body element that contains TabPaneItem bodies. - * @type YAHOO.ext.Element - */ - this.bodyEl = getEl(this.createBody(this.el.dom)); - /** @private */ - this.items = {}; - /** @private */ - this.active = null; - /** - * Fires when the active TabPanelItem changes. Uses fireDirect with signature: (TabPanel this, TabPanelItem activedTab). - * @type CustomEvent - */ - this.onTabChange = new YAHOO.util.CustomEvent('TabItem.onTabChange'); - /** @private */ - this.activateDelegate = this.activate.createDelegate(this); -} - -YAHOO.ext.TabPanel.prototype = { - /** - * Creates a new TabPanelItem by looking for an existing element with the provided id - if it's not found it creates one. - * @param {String} id The id of the div to use or create - * @param {String} text The text for the tab - * @param {<i>String</i>} content (optional) Content to put in the TabPanelItem body - * @return {YAHOO.ext.TabPanelItem} The created TabPanelItem - */ - addTab : function(id, text, content){ - var item = new YAHOO.ext.TabPanelItem(this, id, text); - this.addTabItem(item); - if(content){ - item.setContent(content); - } - return item; - }, - - /** - * Returns the TabPanelItem with the specified id - * @param {String} id The id of the TabPanelItem to fetch. - * @return {YAHOO.ext.TabPanelItem} - */ - getTab : function(id){ - return this.items[id]; - }, - - /** - * Add an existing TabPanelItem. - * @param {YAHOO.ext.TabPanelItem} item The TabPanelItem to add - */ - addTabItem : function(item){ - this.items[item.id] = item; - }, - - /** - * Remove a TabPanelItem. - * @param {String} id The id of the TabPanelItem to remove. - */ - removeTab : function(id){ - var tab = this.items[id]; - if(tab && this.active != tab){ - this.stripEl.dom.removeChild(tab.onEl.dom); - this.stripEl.dom.removeChild(tab.offEl.dom); - this.bodyEl.dom.removeChild(tab.bodyEl.dom); - delete this.items[id]; - } - }, - - /** - * Disable a TabPanelItem. <b>It cannot be the active tab, if it is this call is ignored.</b>. - * @param {String} id The id of the TabPanelItem to disable. - */ - disableTab : function(id){ - var tab = this.items[id]; - if(tab && this.active != tab){ - tab.disable(); - } - }, - - /** - * Enable a TabPanelItem that is disabled. - * @param {String} id The id of the TabPanelItem to enable. - */ - enableTab : function(id){ - var tab = this.items[id]; - tab.enable(); - }, - - /** - * Activate a TabPanelItem. The currently active will be deactivated. - * @param {String} id The id of the TabPanelItem to activate. - */ - activate : function(id){ - var tab = this.items[id]; - if(!tab.disabled){ - if(this.active){ - this.active.hide(); - } - this.active = this.items[id]; - this.active.show(); - this.onTabChange.fireDirect(this, this.active); - } - }, - - /** - * Get the active TabPanelItem - * @return {YAHOO.ext.TabPanelItem} The active TabPanelItem or null if none are active. - */ - getActiveTab : function(){ - return this.active; - } - -}; - -YAHOO.ext.TabPanelItem = function(tabPanel, id, text){ - /** - * The TabPanel this TabPanelItem belongs to - * @type YAHOO.ext.TabPanel - */ - this.tabPanel = tabPanel; - /** - * The id for this TabPanelItem - * @type String - */ - this.id = id; - /** @private */ - this.disabled = false; - /** @private */ - this.text = text; - /** @private */ - this.loaded = false; - - /** - * The body element for this TabPanelItem - * @type YAHOO.ext.Element - */ - this.bodyEl = getEl(tabPanel.createItemBody(tabPanel.bodyEl.dom, id)); - this.bodyEl.originalDisplay = 'block'; - this.bodyEl.setStyle('display', 'none'); - this.bodyEl.enableDisplayMode(); - - var stripElements =tabPanel.createStripElements(tabPanel.stripEl.dom, text); - /** @private */ - this.onEl = getEl(stripElements.on, true); - /** @private */ - this.offEl = getEl(stripElements.off, true); - this.onEl.originalDisplay = 'inline'; - this.onEl.enableDisplayMode(); - this.offEl.originalDisplay = 'inline'; - this.offEl.enableDisplayMode(); - this.offEl.on('click', tabPanel.activateDelegate.createCallback(id)); - /** - * Fires when this TabPanelItem is activated. Uses fireDirect with signature: (TabPanel tabPanel, TabPanelItem this). - * @type CustomEvent - */ - this.onActivate = new YAHOO.util.CustomEvent('TabItem.onActivate'); - /** - * Fires when this TabPanelItem is deactivated. Uses fireDirect with signature: (TabPanel tabPanel, TabPanelItem this). - * @type CustomEvent - */ - this.onDeactivate = new YAHOO.util.CustomEvent('TabItem.onDeactivate'); -}; - -YAHOO.ext.TabPanelItem.prototype = { - /** - * Show this TabPanelItem - this <b>does not</b> deactivate the currently active TabPanelItem. - */ - show : function(){ - this.onEl.show(); - this.offEl.hide(); - this.bodyEl.show(); - this.onActivate.fireDirect(this.tabPanel, this); - }, - - setText : function(text){ - this.onEl.dom.firstChild.firstChild.firstChild.innerHTML = text; - this.offEl.dom.firstChild.firstChild.innerHTML = text; - }, - /** - * Activate this TabPanelItem - this <b>does</b> deactivate the currently active TabPanelItem. - */ - activate : function(){ - this.tabPanel.activate(this.id); - }, - - /** - * Hide this TabPanelItem - if you don't activate another TabPanelItem this could look odd. - */ - hide : function(){ - this.onEl.hide(); - this.offEl.show(); - this.bodyEl.hide(); - this.onDeactivate.fireDirect(this.tabPanel, this); - }, - - /** - * Disable this TabPanelItem - this call is ignore if this is the active TabPanelItem. - */ - disable : function(){ - if(this.tabPanel.active != this){ - this.disabled = true; - this.offEl.addClass('disabled'); - this.offEl.dom.title = 'disabled'; - } - }, - - /** - * Enable this TabPanelItem if it was previously disabled. - */ - enable : function(){ - this.disabled = false; - this.offEl.removeClass('disabled'); - this.offEl.dom.title = ''; - }, - - /** - * Set the content for this TabPanelItem. - * @param {String} content The content - */ - setContent : function(content){ - this.bodyEl.update(content); - }, - - /** - * Get the {@link YAHOO.ext.UpdateManager} for the body of this TabPanelItem. Enables you to perform Ajax updates. - * @return {YAHOO.ext.UpdateManager} The UpdateManager - */ - getUpdateManager : function(){ - return this.bodyEl.getUpdateManager(); - }, - - /** - * Set a URL to be used to load the content for this TabPanelItem. - * @param {String/Function} url The url to load the content from or a function to call to get the url - * @param {<i>String/Object</i>} params (optional) The string params for the update call or an object of the params. See {@link YAHOO.ext.UpdateManager#update} for more details. (Defaults to null) - * @param {<i>Boolean</i>} loadOnce (optional) Whether to only load the content once. If this is false it makes the Ajax call every time this TabPanelItem is activated. (Defaults to false) - * @return {YAHOO.ext.UpdateManager} The UpdateManager - */ - setUrl : function(url, params, loadOnce){ - this.onActivate.subscribe(this._handleRefresh.createDelegate(this, [url, params, loadOnce])); - }, - - /** @private */ - _handleRefresh : function(url, params, loadOnce){ - if(!loadOnce || !this.loaded){ - var updater = this.bodyEl.getUpdateManager(); - updater.update(url, params, this._setLoaded.createDelegate(this)); - } - }, - - /** @private */ - _setLoaded : function(){ - this.loaded = true; - } -}; -/** @private */ -YAHOO.ext.TabPanel.prototype.createStrip = function(container){ - var strip = document.createElement('div'); - YAHOO.util.Dom.addClass(strip, 'tabset'); - container.appendChild(strip); - var stripInner = document.createElement('div'); - YAHOO.util.Dom.generateId(stripInner, 'tab-strip'); - YAHOO.util.Dom.addClass(stripInner, 'hd'); - strip.appendChild(stripInner); - return stripInner; -}; -/** @private */ -YAHOO.ext.TabPanel.prototype.createStripList = function(strip){ - var list = document.createElement('ul'); - YAHOO.util.Dom.generateId(list, 'tab-strip-list'); - strip.appendChild(list); - return list; -}; -/** @private */ -YAHOO.ext.TabPanel.prototype.createBody = function(container){ - var body = document.createElement('div'); - YAHOO.util.Dom.generateId(body, 'tab-body'); - YAHOO.util.Dom.addClass(body, 'yui-ext-tabbody'); - container.appendChild(body); - return body; -}; -/** @private */ -YAHOO.ext.TabPanel.prototype.createItemBody = function(bodyEl, id){ - var body = YAHOO.util.Dom.get(id); - if(!body){ - body = document.createElement('div'); - body.id = id; - } - YAHOO.util.Dom.addClass(body, 'yui-ext-tabitembody'); - bodyEl.appendChild(body); - return body; -}; -/** @private */ -YAHOO.ext.TabPanel.prototype.createStripElements = function(stripEl, text){ - var li = document.createElement('li'); - var a = document.createElement('a'); - var em = document.createElement('em'); - - stripEl.appendChild(li); - li.appendChild(a); - a.appendChild(em); - em.innerHTML = text; - - var li2 = document.createElement('li'); - var a2 = document.createElement('a'); - var em2 = document.createElement('em'); - var strong = document.createElement('strong'); - - stripEl.appendChild(li2); - YAHOO.util.Dom.addClass(li2, 'on'); - YAHOO.util.Dom.setStyle(li2, 'display', 'none'); - li2.appendChild(a2); - a2.appendChild(strong); - strong.appendChild(em2); - em2.innerHTML = text; - - return {on: li2, off: li}; -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.TextEditor | -- |
YAHOO.ext.grid.TextEditor = function(config){ - var element = document.createElement('input'); - element.type = 'text'; - element.className = 'ygrid-editor ygrid-text-editor'; - element.setAttribute('autocomplete', 'off'); - document.body.appendChild(element); - YAHOO.ext.grid.TextEditor.superclass.constructor.call(this, element); - YAHOO.ext.util.Config.apply(this, config); -}; -YAHOO.extendX(YAHOO.ext.grid.TextEditor, YAHOO.ext.grid.CellEditor); - -YAHOO.ext.grid.TextEditor.prototype.validate = function(){ - var dom = this.element.dom; - var value = dom.value; - if(value.length < 1){ // if it's blank - if(this.allowBlank){ - dom.title = ''; - this.element.removeClass('ygrid-editor-invalid'); - return true; - }else{ - dom.title = this.blankText; - this.element.addClass('ygrid-editor-invalid'); - return false; - } - } - if(value.length < this.minLength){ - dom.title = this.minText.replace('%0', this.minLength); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - if(value.length > this.maxLength){ - dom.title = this.maxText.replace('%0', this.maxLength); - this.element.addClass('ygrid-editor-invalid'); - return false; - } - var msg = this.validator(value); - if(msg !== true){ - dom.title = msg; - this.element.addClass('ygrid-editor-invalid'); - return false; - } - if(this.regex && !this.regex.test(value)){ - dom.title = this.regexText; - this.element.addClass('ygrid-editor-invalid'); - return false; - } - dom.title = ''; - this.element.removeClass('ygrid-editor-invalid'); - return true; -}; - -YAHOO.ext.grid.TextEditor.prototype.initEvents = function(){ - YAHOO.ext.grid.TextEditor.superclass.initEvents.call(this); - var vtask = new YAHOO.ext.util.DelayedTask(this.validate, this); - this.element.mon('keyup', vtask.delay.createDelegate(vtask, [this.validationDelay])); -}; - -YAHOO.ext.grid.TextEditor.prototype.show = function(){ - this.element.dom.title = ''; - YAHOO.ext.grid.TextEditor.superclass.show.call(this); - this.element.focus(); - if(this.selectOnFocus){ - try{ - this.element.dom.select(); - }catch(e){} - } - this.validate(this.element.dom.value); -}; - -YAHOO.ext.grid.TextEditor.prototype.getValue = function(){ - if(!this.validate()){ - return this.originalValue; - }else{ - return this.element.dom.value; - } -}; - -YAHOO.ext.grid.TextEditor.prototype.allowBlank = true; -YAHOO.ext.grid.TextEditor.prototype.minLength = 0; -YAHOO.ext.grid.TextEditor.prototype.maxLength = Number.MAX_VALUE; -YAHOO.ext.grid.TextEditor.prototype.minText = 'The minimum length for this field is %0'; -YAHOO.ext.grid.TextEditor.prototype.maxText = 'The maximum length for this field is %0'; -YAHOO.ext.grid.TextEditor.prototype.selectOnFocus = true; -YAHOO.ext.grid.TextEditor.prototype.blankText = 'This field cannot be blank'; -YAHOO.ext.grid.TextEditor.prototype.validator = function(){return true;}; -YAHOO.ext.grid.TextEditor.prototype.validationDelay = 200; -YAHOO.ext.grid.TextEditor.prototype.regex = null; -YAHOO.ext.grid.TextEditor.prototype.regexText = '';-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.Toolbar | -Basic Toolbar used by the Grid to create the paging toolbar. | -
| YAHOO.ext.ToolbarButton | -A toolbar button. | -
/** - * @class - * Basic Toolbar used by the Grid to create the paging toolbar. This class is reusable but functionality - * is limited. Look for more functionality in a future version. - */ - YAHOO.ext.Toolbar = function(container){ - this.el = getEl(container, true); - var div = document.createElement('div'); - div.className = 'ytoolbar'; - var tb = document.createElement('table'); - tb.border = 0; - tb.cellPadding = 0; - tb.cellSpacing = 0; - div.appendChild(tb); - var tbody = document.createElement('tbody'); - tb.appendChild(tbody); - var tr = document.createElement('tr'); - tbody.appendChild(tr); - this.el.dom.appendChild(div); - this.tr = tr; -}; - -YAHOO.ext.Toolbar.prototype = { - /** - * Adds element(s) to the toolbar - this function takes a variable number of - * arguments of mixed type and adds them to the toolbar... - * If an argument is a ToolbarButton, it is added. If the element is a string, it is wrapped - * in a ytb-text element and added unless the text is "separator" in which case a separator - * is added. Otherwise, it is assumed the element is an HTMLElement and it is added directly. - */ - add : function(){ - for(var i = 0; i < arguments.length; i++){ - var el = arguments[i]; - var td = document.createElement('td'); - this.tr.appendChild(td); - if(el instanceof YAHOO.ext.ToolbarButton){ - el.init(td); - }else if(typeof el == 'string'){ - var span = document.createElement('span'); - if(el == 'separator'){ - span.className = 'ytb-sep'; - }else{ - span.innerHTML = el; - span.className = 'ytb-text'; - } - td.appendChild(span); - }else if(typeof el == 'object'){ // must be element? - td.appendChild(el); - } - } - }, - - addSeparator : function(){ - var td = document.createElement('td'); - this.tr.appendChild(td); - var span = document.createElement('span'); - span.className = 'ytb-sep'; - td.appendChild(span); - }, - - /** - * Adds a button, see {@link YAHOO.ext.ToolbarButton} for more info on the config - * @return {YAHOO.ext.ToolbarButton} - */ - addButton : function(config){ - var b = new YAHOO.ext.ToolbarButton(config); - this.add(b); - return b; - }, - - addText : function(text){ - var td = document.createElement('td'); - this.tr.appendChild(td); - var span = document.createElement('span'); - span.className = 'ytb-text'; - span.innerHTML = text; - td.appendChild(span); - return span; - } -}; - -/** - * @class - * A toolbar button. The config has the following options: - * <ul> - * <li>className - The CSS class for the button. Use this to attach a background image for an icon.</li> - * <li>text - The button's text</li> - * <li>tooltip - The buttons tooltip text</li> - * <li>click - function to call when the button is clicked</li> - * <li>mouseover - function to call when the mouse moves over the button</li> - * <li>mouseout - function to call when the mouse moves off the button</li> - * <li>scope - The scope of the above event handlers</li> - * <li></li> - * <li></li> - */ -YAHOO.ext.ToolbarButton = function(config){ - YAHOO.ext.util.Config.apply(this, config); -}; - -YAHOO.ext.ToolbarButton.prototype = { - /** @private */ - init : function(appendTo){ - var element = document.createElement('span'); - element.className = 'ytb-button'; - this.disabled = (this.disabled === true); - var inner = document.createElement('span'); - inner.className = 'ytb-button-inner ' + this.className; - if(this.tooltip){ - element.setAttribute('title', this.tooltip); - } - element.appendChild(inner); - appendTo.appendChild(element); - this.el = getEl(element, true); - inner.innerHTML = (this.text ? this.text : ' '); - this.el.mon('click', this.onClick, this, true); - this.el.mon('mouseover', this.onMouseOver, this, true); - this.el.mon('mouseout', this.onMouseOut, this, true); - }, - - disable : function(){ - this.disabled = true; - if(this.el){ - this.el.addClass('ytb-button-disabled'); - } - }, - - enable : function(){ - this.disabled = false; - if(this.el){ - this.el.removeClass('ytb-button-disabled'); - } - }, - - isDisabled : function(){ - return this.disabled === true; - }, - - setDisabled : function(disabled){ - if(disabled){ - this.disable(); - }else{ - this.enable(); - } - }, - - /** @private */ - onClick : function(){ - if(!this.disabled && this.click){ - this.click.call(this.scope || window, this); - } - }, - - /** @private */ - onMouseOver : function(){ - if(!this.disabled){ - this.el.addClass('ytb-button-over'); - if(this.mouseover){ - this.mouseover.call(this.scope || window, this); - } - } - }, - - /** @private */ - onMouseOut : function(){ - this.el.removeClass('ytb-button-over'); - if(!this.disabled){ - if(this.mouseout){ - this.mouseout.call(this.scope || window, this); - } - } - } -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.UpdateManager | -Provides AJAX-style update for Element object using Yahoo
- UI library YAHOO.util.Connect functionality. - Usage: - |
-
| YAHOO.ext.UpdateManager.BasicRenderer | -Default Content renderer. | -
/** - * @class Provides AJAX-style update for Element object using Yahoo - * UI library YAHOO.util.Connect functionality.<br><br> - * Usage:<br> - * <pre><code> - * // Get it from a YAHOO.ext.Element object - * var mgr = myElement.getUpdateManager(); - * mgr.update('http://myserver.com/index.php', 'param1=1&param2=2'); - * ... - * mgr.formUpdate('myFormId', 'http://myserver.com/index.php'); - * <br> - * // or directly (returns the same UpdateManager instance) - * var mgr = new YAHOO.ext.UpdateManager('myElementId'); - * mgr.startAutoRefresh('http://myserver.com/index.php', 60); - * mgr.onUpdate.subscribe(myFcnNeedsToKnow); - * <br> - * </code></pre> - * @requires YAHOO.ext.Element - * @requires YAHOO.util.Dom - * @requires YAHOO.util.Event - * @requires YAHOO.util.CustomEvent - * @requires YAHOO.util.Connect - * @constructor - * Create new UpdateManager. - * @param {String/HTMLElement/YAHOO.ext.Element} el The element to update - * @param {<i>Boolean</i>} forceNew (optional) By default the constructor checks to see if the passed element already has an UpdateManager and if it does it returns the same instance. This will skip that check (useful for extending this class). - */ -YAHOO.ext.UpdateManager = function(el, forceNew){ - el = YAHOO.ext.Element.get(el); - if(!forceNew && el.updateManager){ - return el.updateManager; - } - /** - * The Element object - * @type YAHOO.ext.Element - */ - this.el = el; - /** - * Cached url to use for refreshes. Overwritten every time update() is called unless 'discardUrl' param is set to true. - * @type String - */ - this.defaultUrl = null; - /** - * fired before update is made, return false from your handler and the update is cancelled. - * Uses fireDirect with signature: (oElement, url, params) - * @type YAHOO.util.CustomEvent - */ - this.beforeUpdate = new YAHOO.util.CustomEvent('UpdateManager.beforeUpdate'); - /** - * Fired after successful update is made. Uses fireDirect with signature: (oElement, oResponseObject) - * @type YAHOO.util.CustomEvent - */ - this.onUpdate = new YAHOO.util.CustomEvent('UpdateManager.onUpdate'); - /** - * Fired on update failure. Uses fireDirect with signature: (oElement, oResponseObject) - * @type YAHOO.util.CustomEvent - */ - this.onFailure = new YAHOO.util.CustomEvent('UpdateManager.onFailure'); - - /** - * Blank page URL to use with SSL file uploads (Defaults to YAHOO.ext.UpdateManager.defaults.sslBlankUrl or 'about:blank'). - * @type String - */ - this.sslBlankUrl = YAHOO.ext.UpdateManager.defaults.sslBlankUrl; - /** - * Whether to append unique parameter on get request to disable caching (Defaults to YAHOO.ext.UpdateManager.defaults.disableCaching or false). - * @type Boolean - */ - this.disableCaching = YAHOO.ext.UpdateManager.defaults.disableCaching; - /** - * Text for loading indicator (Defaults to YAHOO.ext.UpdateManager.defaults.indicatorText or '<div class="loading-indicator">Loading...</div>'). - * @type String - */ - this.indicatorText = YAHOO.ext.UpdateManager.defaults.indicatorText; - /** - * Whether to show indicatorText when loading (Defaults to YAHOO.ext.UpdateManager.defaults.showLoadIndicator or true). - * @type String - */ - this.showLoadIndicator = YAHOO.ext.UpdateManager.defaults.showLoadIndicator; - /** - * Timeout for requests or form posts in seconds (Defaults to YAHOO.ext.UpdateManager.defaults.timeout or 30 seconds). - * @type Number - */ - this.timeout = YAHOO.ext.UpdateManager.defaults.timeout; - - /** - * True to process scripts in the output (Defaults to YAHOO.ext.UpdateManager.defaults.loadScripts (false)). - * @type Number - */ - this.loadScripts = YAHOO.ext.UpdateManager.defaults.loadScripts; - - /** - * YAHOO.util.Connect transaction object of current executing transaction - */ - this.transaction = null; - - /** - * @private - */ - this.autoRefreshProcId = null; - /** - * Delegate for refresh() prebound to 'this', use myUpdater.refreshDelegate.createCallback(arg1, arg2) to bind arguments - * @type Function - */ - this.refreshDelegate = this.refresh.createDelegate(this); - /** - * Delegate for update() prebound to 'this', use myUpdater.updateDelegate.createCallback(arg1, arg2) to bind arguments - * @type Function - */ - this.updateDelegate = this.update.createDelegate(this); - /** - * Delegate for formUpdate() prebound to 'this', use myUpdater.formUpdateDelegate.createCallback(arg1, arg2) to bind arguments - * @type Function - */ - this.formUpdateDelegate = this.formUpdate.createDelegate(this); - /** - * @private - */ - this.successDelegate = this.processSuccess.createDelegate(this); - /** - * @private - */ - this.failureDelegate = this.processFailure.createDelegate(this); - - /** - * The renderer for this UpdateManager. Defaults to {@link YAHOO.ext.UpdateManager.BasicRenderer}. - */ - this.renderer = new YAHOO.ext.UpdateManager.BasicRenderer(); -}; - -YAHOO.ext.UpdateManager.prototype = { - /** - * Get the Element this UpdateManager is bound to - * @return {YAHOO.ext.Element} The element - */ - getEl : function(){ - return this.el; - }, - - /** - * Performs an async request, updating this element with the response. If params are specified it uses POST, otherwise it uses GET. - * @param {String/Function} url The url for this request or a function to call to get the url - * @param {<i>String/Object</i>} params (optional) The parameters to pass as either a url encoded string "param1=1&param2=2" or as an object {param1: 1, param2: 2} - * @param {<i>Function</i>} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess) - * @param {<i>Boolean</i>} discardUrl (optional) By default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url. - */ - update : function(url, params, callback, discardUrl){ - if(this.beforeUpdate.fireDirect(this.el, url, params) !== false){ - this.showLoading(); - if(!discardUrl){ - this.defaultUrl = url; - } - if(typeof url == 'function'){ - url = url(); - } - if(params && typeof params != 'string'){ // must be object - var buf = []; - for(var key in params){ - if(typeof params[key] != 'function'){ - buf.push(encodeURIComponent(key), '=', encodeURIComponent(params[key]), '&'); - } - } - delete buf[buf.length-1]; - params = buf.join(''); - } - var callback = { - success: this.successDelegate, - failure: this.failureDelegate, - timeout: (this.timeout*1000), - argument: {'url': url, 'form': null, 'callback': callback, 'params': params} - }; - var method = params ? 'POST' : 'GET'; - if(method == 'GET'){ - url = this.prepareUrl(url); - } - this.transaction = YAHOO.util.Connect.asyncRequest(method, url, callback, params); - } - }, - - /** - * Performs an async form post, updating this element with the response. If the form has the attribute enctype="multipart/form-data", it assumes it's a file upload. - * Uses this.sslBlankUrl for SSL file uploads to prevent IE security warning. See YUI docs for more info. - * @param {String/HTMLElement} form The form Id or form element - * @param {<i>String</i>} url (optional) The url to pass the form to. If omitted the action attribute on the form will be used. - * @param {<i>Boolean</i>} reset (optional) Whether to try to reset the form after the update - * @param {<i>Function</i>} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess) - */ - formUpdate : function(form, url, reset, callback){ - if(this.beforeUpdate.fireDirect(this.el, form, url) !== false){ - this.showLoading(); - formEl = YAHOO.util.Dom.get(form); - if(typeof url == 'function'){ - url = url(); - } - url = url || formEl.action; - var callback = { - success: this.successDelegate, - failure: this.failureDelegate, - timeout: (this.timeout*1000), - argument: {'url': url, 'form': form, 'callback': callback, 'reset': reset} - }; - var isUpload = false; - var enctype = formEl.getAttribute('enctype'); - if(enctype && enctype.toLowerCase() == 'multipart/form-data'){ - isUpload = true; - } - YAHOO.util.Connect.setForm(form, isUpload, this.sslBlankUrl); - this.transaction = YAHOO.util.Connect.asyncRequest('POST', url, callback); - } - }, - - /** - * Refresh the element with the last used url or defaultUrl. If there is no url, it returns immediately - * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess) - */ - refresh : function(callback){ - if(this.defaultUrl == null){ - return; - } - this.update(this.defaultUrl, null, callback, true); - }, - - /** - * Set this element to auto refresh. - * @param {Number} interval How often to update (in seconds). - * @param {<i>String/Function</i>} url (optional) The url for this request or a function to call to get the url (Defaults to the last used url) - * @param {<i>String/Object</i>} params (optional) The parameters to pass as either a url encoded string "¶m1=1¶m2=2" or as an object {param1: 1, param2: 2} - * @param {<i>Function</i>} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess) - * @param {<i>Boolean</i>} refreshNow (optional) Whether to execute the refresh now, or wait the interval - */ - startAutoRefresh : function(interval, url, params, callback, refreshNow){ - if(refreshNow){ - this.update(url || this.defaultUrl, params, callback, true); - } - if(this.autoRefreshProcId){ - clearInterval(this.autoRefreshProcId); - } - this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000); - }, - - /** - * Stop auto refresh on this element. - */ - stopAutoRefresh : function(){ - if(this.autoRefreshProcId){ - clearInterval(this.autoRefreshProcId); - } - }, - - /** - * Called to update the element to "Loading" state. Override to perform custom action. - */ - showLoading : function(){ - if(this.showLoadIndicator){ - this.el.update(this.indicatorText); - } - }, - - /** - * Adds unique parameter to query string if disableCaching = true - * @private - */ - prepareUrl : function(url){ - if(this.disableCaching){ - var append = '_dc=' + (new Date().getTime()); - if(url.indexOf('?') !== -1){ - url += '&' + append; - }else{ - url += '?' + append; - } - } - return url; - }, - - /** - * @private - */ - processSuccess : function(response){ - this.transaction = null; - this.renderer.render(this.el, response, this); - if(response.argument.form && response.argument.reset){ - try{ // put in try/catch since some older FF releases had problems with this - response.argument.form.reset(); - }catch(e){} - } - this.onUpdate.fireDirect(this.el, response); - if(typeof response.argument.callback == 'function'){ - response.argument.callback(this.el, true); - } - }, - - /** - * @private - */ - processFailure : function(response){ - this.transaction = null; - this.onFailure.fireDirect(this.el, response); - if(typeof response.argument.callback == 'function'){ - response.argument.callback(this.el, false); - } - }, - - /** - * Set the content renderer for this UpdateManager. See {@link YAHOO.ext.UpdateManager.BasicRenderer#render} for more details. - * @param {Object} renderer The object implementing the render() method - */ - setRenderer : function(renderer){ - this.renderer = renderer; - }, - - getRenderer : function(){ - return this.renderer; - }, - - /** - * Set the defaultUrl used for updates - * @param {String/Function} defaultUrl The url or a function to call to get the url - */ - setDefaultUrl : function(defaultUrl){ - this.defaultUrl = defaultUrl; - }, - - /** - * Aborts the executing transaction - */ - abort : function(){ - if(this.transaction){ - YAHOO.util.Connect.abort(this.transaction); - } - }, - - /** - * Returns true if an update is in progress - */ - isUpdating : function(){ - if(this.transaction){ - return YAHOO.util.Connect.isCallInProgress(this.transaction); - } - return false; - } -}; - -/** - * Static convenience method, Usage: - * YAHOO.ext.UpdateManager.update('my-div', 'stuff.php'); - * @param {String/HTMLElement/YAHOO.ext.Element} el The element to update - * @param {String} url The url - * @param {<i>String/Object</i>} params (optional) Url encoded param string or an object of name/value pairs - * @param {<i>Object</i>} options (optional) A config object with any of the UpdateManager properties you want to set - for example: {disableCaching:true, indicatorText: 'Loading data...'} - */ -YAHOO.ext.UpdateManager.update = function(el, url, params, options){ - var um = getEl(el, true).getUpdateManager(); - YAHOO.ext.util.Config.apply(um, options); - um.update(url, params, options.callback); -} - -/** - * @class - * Default Content renderer. Updates the elements innerHTML with the responseText. - */ -YAHOO.ext.UpdateManager.BasicRenderer = function(){}; - -YAHOO.ext.UpdateManager.BasicRenderer.prototype = { - /** - * This is called when the transaction is completed and it's time to update the element - The BasicRenderer - * updates the elements innerHTML with the responseText - To perform a custom render (i.e. XML or JSON processing), - * create an object with a "render(el, response)" method and pass it to setRenderer on the UpdateManager. - * @param {YAHOO.ext.Element} el The element being rendered - * @param {Object} response The YUI Connect response object - */ - render : function(el, response, updateManager){ - el.update(response.responseText, updateManager.loadScripts); - } -}; - -/** - * The defaults collection enables customizing the default behavior of UpdateManager - */ -YAHOO.ext.UpdateManager.defaults = {}; -/** - * Timeout for requests or form posts in seconds (Defaults 30 seconds). - * @type Number - */ - YAHOO.ext.UpdateManager.defaults.timeout = 30; - /** - * True to process scripts by default (Defaults to false). - * @type Number - */ - YAHOO.ext.UpdateManager.defaults.loadScripts = false; - -/** -* Blank page URL to use with SSL file uploads (Defaults to 'about:blank'). -* @type String -*/ -YAHOO.ext.UpdateManager.defaults.sslBlankUrl = 'about:blank'; -/** - * Whether to append unique parameter on get request to disable caching (Defaults to false). - * @type Boolean - */ -YAHOO.ext.UpdateManager.defaults.disableCaching = false; -/** - * Whether to show indicatorText when loading (Defaults to true). - * @type String - */ -YAHOO.ext.UpdateManager.defaults.showLoadIndicator = true; -/** - * Text for loading indicator (Defaults to '<div class="loading-indicator">Loading...</div>'). - * @type String - */ -YAHOO.ext.UpdateManager.defaults.indicatorText = '<div class="loading-indicator">Loading...</div>';-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.grid.XMLDataModel | -This is an implementation of a DataModel used by the Grid. | -
-/** - * @class - * This is an implementation of a DataModel used by the Grid. It works - * with XML data. - * <br>Example schema from Amazon search: - * <pre><code> - * var schema = { - * tagName: 'Item', - * id: 'ASIN', - * fields: ['Author', 'Title', 'Manufacturer', 'ProductGroup'] - * }; - * </code></pre> - * @extends YAHOO.ext.grid.LoadableDataModel - * @constructor - * @param {Object} schema The schema to use - * @param {XMLDocument} xml An XML document to load immediately -*/ -YAHOO.ext.grid.XMLDataModel = function(schema, xml){ - YAHOO.ext.grid.XMLDataModel.superclass.constructor.call(this, YAHOO.ext.grid.LoadableDataModel.XML); - /**@private*/ - this.schema = schema; - this.xml = xml; - if(xml){ - this.loadData(xml); - } -}; -YAHOO.extendX(YAHOO.ext.grid.XMLDataModel, YAHOO.ext.grid.LoadableDataModel); - -YAHOO.ext.grid.XMLDataModel.prototype.getDocument = function(){ - return this.xml; -}; - -/** - * Overrides loadData in LoadableDataModel to process XML - * @param {XMLDocument} doc The document to load - * @param {<i>Function</i>} callback (optional) callback to call when loading is complete - * @param {<i>Boolean</i>} keepExisting (optional) true to keep existing data - * @param {<i>Number</i>} insertIndex (optional) if present, loaded data is inserted at the specified index instead of overwriting existing data - */ -YAHOO.ext.grid.XMLDataModel.prototype.loadData = function(doc, callback, keepExisting, insertIndex){ - this.xml = doc; - var idField = this.schema.id; - var fields = this.schema.fields; - if(this.schema.totalTag){ - this.totalCount = null; - var totalNode = doc.getElementsByTagName(this.schema.totalTag); - if(totalNode && totalNode.item(0) && totalNode.item(0).firstChild) { - var v = parseInt(totalNode.item(0).firstChild.nodeValue, 10); - if(!isNaN(v)){ - this.totalCount = v; - } - } - } - var rowData = []; - var nodes = doc.getElementsByTagName(this.schema.tagName); - if(nodes && nodes.length > 0) { - for(var i = 0; i < nodes.length; i++) { - var node = nodes.item(i); - var colData = []; - colData.node = node; - colData.id = this.getNamedValue(node, idField, String(i)); - for(var j = 0; j < fields.length; j++) { - var val = this.getNamedValue(node, fields[j], ""); - if(this.preprocessors[j]){ - val = this.preprocessors[j](val); - } - colData.push(val); - } - rowData.push(colData); - } - } - if(keepExisting !== true){ - YAHOO.ext.grid.XMLDataModel.superclass.removeAll.call(this); - } - if(typeof insertIndex != 'number'){ - insertIndex = this.getRowCount(); - } - YAHOO.ext.grid.XMLDataModel.superclass.insertRows.call(this, insertIndex, rowData); - if(typeof callback == 'function'){ - callback(this, true); - } - this.fireLoadEvent(); -}; - -/** - * Adds a row to this DataModel and syncs the XML document - * @param {String} id The id of the row, if null the next row index is used - * @param {Array} cellValues The cell values for this row - * @return {Number} The index of the new row - */ -YAHOO.ext.grid.XMLDataModel.prototype.addRow = function(id, cellValues){ - var newIndex = this.getRowCount(); - var node = this.createNode(this.xml, id, cellValues); - cellValues.id = id || newIndex; - cellValues.node = node; - YAHOO.ext.grid.XMLDataModel.superclass.addRow.call(this, cellValues); - return newIndex; -}; - -/** - * Inserts a row into this DataModel and syncs the XML document - * @param {Number} index The index to insert the row - * @param {String} id The id of the row, if null the next row index is used - * @param {Array} cellValues The cell values for this row - * @return {Number} The index of the new row - */ -YAHOO.ext.grid.XMLDataModel.prototype.insertRow = function(index, id, cellValues){ - var node = this.createNode(this.xml, id, cellValues); - cellValues.id = id || this.getRowCount(); - cellValues.node = node; - YAHOO.ext.grid.XMLDataModel.superclass.insertRow.call(this, index, cellValues); - return index; -}; - -/** - * Removes the row from DataModel and syncs the XML document - * @param {Number} index The index of the row to remove - */ -YAHOO.ext.grid.XMLDataModel.prototype.removeRow = function(index){ - var node = this.data[index].node; - node.parentNode.removeChild(node); - YAHOO.ext.grid.XMLDataModel.superclass.removeRow.call(this, index, index); -}; - -YAHOO.ext.grid.XMLDataModel.prototype.getNode = function(rowIndex){ - return this.data[rowIndex].node; -}; - -/** - * Override this method to define your own node creation routine for when new rows are added. - * By default this method clones the first node and sets the column values in the newly cloned node. - * @param {XMLDocument} xmlDoc The xml document being used by this model - * @param {Array} colData The column data for the new node - * @return {XMLNode} The created node - */ -YAHOO.ext.grid.XMLDataModel.prototype.createNode = function(xmlDoc, id, colData){ - var template = this.data[0].node; - var newNode = template.cloneNode(true); - var fields = this.schema.fields; - for(var i = 0; i < fields.length; i++){ - var nodeValue = colData[i]; - if(this.postprocessors[i]){ - nodeValue = this.postprocessors[i](nodeValue); - } - this.setNamedValue(newNode, fields[i], nodeValue); - } - if(id){ - this.setNamedValue(newNode, this.schema.idField, id); - } - template.parentNode.appendChild(newNode); - return newNode; -}; - -/** - * Convenience function looks for value in attributes, then in children tags - also - * normalizes namespace matches (ie matches ns:tag, FireFox matches tag and not ns:tag). - */ -YAHOO.ext.grid.XMLDataModel.prototype.getNamedValue = function(node, name, defaultValue){ - if(!node || !name){ - return defaultValue; - } - var nodeValue = defaultValue; - var attrNode = node.attributes.getNamedItem(name); - if(attrNode) { - nodeValue = attrNode.value; - } else { - var childNode = node.getElementsByTagName(name); - if(childNode && childNode.item(0) && childNode.item(0).firstChild) { - nodeValue = childNode.item(0).firstChild.nodeValue; - }else{ - // try to strip namespace for FireFox - var index = name.indexOf(':'); - if(index > 0){ - return this.getNamedValue(node, name.substr(index+1), defaultValue); - } - } - } - return nodeValue; -}; - -/** - * Convenience function set a value in the underlying xml node. - */ -YAHOO.ext.grid.XMLDataModel.prototype.setNamedValue = function(node, name, value){ - if(!node || !name){ - return; - } - var attrNode = node.attributes.getNamedItem(name); - if(attrNode) { - attrNode.value = value; - return; - } - var childNode = node.getElementsByTagName(name); - if(childNode && childNode.item(0) && childNode.item(0).firstChild) { - childNode.item(0).firstChild.nodeValue = value; - }else{ - // try to strip namespace for FireFox - var index = name.indexOf(':'); - if(index > 0){ - this.setNamedValue(node, name.substr(index+1), value); - } - } -}; - -/** - * Overrides DefaultDataModel.setValueAt to update the underlying XML Document - * @param {Object} value The new value - * @param {Number} rowIndex - * @param {Number} colIndex - */ -YAHOO.ext.grid.XMLDataModel.prototype.setValueAt = function(value, rowIndex, colIndex){ - var node = this.data[rowIndex].node; - if(node){ - var nodeValue = value; - if(this.postprocessors[colIndex]){ - nodeValue = this.postprocessors[colIndex](value); - } - this.setNamedValue(node, this.schema.fields[colIndex], nodeValue); - } - YAHOO.ext.grid.XMLDataModel.superclass.setValueAt.call(this, value, rowIndex, colIndex); -}; - -/** - * Overrides getRowId in DefaultDataModel to return the ID value of the specified node. - * @param {Number} rowIndex - * @return {Number} - */ -YAHOO.ext.grid.XMLDataModel.prototype.getRowId = function(rowIndex){ - return this.data[rowIndex].id; -};-
- - - -
- - -| - - Class Summary - - | -|
| YAHOO.ext.util.Bench | -Very simple Benchmark class that supports multiple timers - | -
| YAHOO.ext.util.DelayedTask | -Provides a convenient method of performing setTimeout where a new - timeout cancels the old timeout. | -
| YAHOO.ext.util.Observable | -- |
-YAHOO.namespace('ext'); -YAHOO.namespace('ext.util'); -YAHOO.ext.Strict = (document.compatMode == 'CSS1Compat'); - -/** - * Creates a callback that passes arguments[0], arguments[1], arguments[2], ... - * Call directly on any function. Example: <code>myFunction.createCallback(myarg, myarg2)</code> - * Will create a function that is bound to those 2 args. - * @addon - * @return {Function} The new function -*/ -Function.prototype.createCallback = function(/*args...*/){ - // make args available, in function below - var args = arguments; - var method = this; - return function() { - return method.apply(window, args); - } -}; - -/** - * Creates a delegate (callback) that sets the scope to obj. - * Call directly on any function. Example: <code>this.myFunction.createDelegate(this)</code> - * Will create a function that is automatically scoped to this. - * @addon - * @param {Object} obj The object for which the scope is set - * @param {<i>Array</i>} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller) - * @param {<i>Boolean</i>} appendArgs (optional) if True args are appended to call args instead of overriding - * @return {Function} The new function - */ -Function.prototype.createDelegate = function(obj, args, appendArgs){ - var method = this; - return function() { - var callargs = args || arguments; - if(appendArgs){ - callargs = Array.prototype.concat.apply(arguments, args); - } - return method.apply(obj || window, callargs); - } -}; - -/** - * Create a combined function call sequence of the original function + the passed function. - * The resulting function returns the results of the original function. - * The passed fcn is called with the parameters of the original function - * @addon - * @param {Function} fcn The function to sequence - * @param {<i>Object</i>} scope (optional) The scope of the passed fcn (Defaults to scope of original function or window) - * @return {Function} The new function - */ -Function.prototype.createSequence = function(fcn, scope){ - if(typeof fcn != 'function'){ - return this; - } - var method = this; - return function() { - var retval = method.apply(this || window, arguments); - fcn.apply(scope || this || window, arguments); - return retval; - } -}; - -/** - * Creates an interceptor function. The passed fcn is called before the original one. If it returns false, the original one is not called. - * The resulting function returns the results of the original function. - * The passed fcn is called with the parameters of the original function. - * @addon - * @param {Function} fcn The function to call before the original - * @param {<i>Object</i>} scope (optional) The scope of the passed fcn (Defaults to scope of original function or window) - * @return {Function} The new function - */ -Function.prototype.createInterceptor = function(fcn, scope){ - if(typeof fcn != 'function'){ - return this; - } - var method = this; - return function() { - fcn.target = this; - fcn.method = method; - if(fcn.apply(scope || this || window, arguments) === false) - return; - return method.apply(this || window, arguments);; - } -}; - -/** - * @class - * @constructor - */ -YAHOO.ext.util.Browser = new function(){ - var ua = navigator.userAgent.toLowerCase(); - /** @type Boolean */ - this.isOpera = (ua.indexOf('opera') > -1); - /** @type Boolean */ - this.isSafari = (ua.indexOf('webkit') > -1); - /** @type Boolean */ - this.isIE = (window.ActiveXObject); - /** @type Boolean */ - this.isIE7 = (ua.indexOf('msie 7') > -1); - /** @type Boolean */ - this.isGecko = !this.isSafari && (ua.indexOf('gecko') > -1); -}(); - -/** - * Enable custom handler signature and event cancelling. Using fireDirect() instead of fire() calls the subscribed event handlers - * with the exact parameters passed to fireDirect, instead of the usual (eventType, args[], obj). IMO this is more intuitive - * and promotes cleaner code. Also, if an event handler returns false, it is returned by fireDirect and no other handlers will be called.<br> - * Example:<br><br><pre><code> - * if(beforeUpdateEvent.fireDirect(myArg, myArg2) !== false){ - * // do update - * }</code></pre> - * @addon - */ -YAHOO.util.CustomEvent.prototype.fireDirect = function(){ - var len=this.subscribers.length; - for (var i=0; i<len; ++i) { - var s = this.subscribers[i]; - if(s){ - var scope = (s.override) ? s.obj : this.scope; - if(s.fn.apply(scope, arguments) === false){ - return false; - } - } - } - return true; -}; - -YAHOO.extendX = function(subclass, superclass, overrides){ - YAHOO.extend(subclass, superclass); - subclass.override = function(o){ - YAHOO.override(subclass, o); - }; - subclass.prototype.override = function(o){ - for(var method in o){ - this[method] = o[method]; - } - }; - if(overrides){ - subclass.override(overrides); - } -}; - -YAHOO.override = function(origclass, overrides){ - if(overrides){ - var p = origclass.prototype; - for(var method in overrides){ - p[method] = overrides[method]; - } - } -}; - -/** - * @class - * Very simple Benchmark class that supports multiple timers - * @constructor - */ -YAHOO.ext.util.Bench = function(){ - this.timers = {}; - this.lastKey = null; -}; -YAHOO.ext.util.Bench.prototype = { - start : function(key){ - this.lastKey = key; - this.timers[key] = {}; - this.timers[key].startTime = new Date().getTime(); - }, - - stop : function(key){ - key = key || this.lastKey; - this.timers[key].endTime = new Date().getTime(); - }, - - getElapsed : function(key){ - key = key || this.lastKey; - return this.timers[key].endTime - this.timers[key].startTime; - }, - - toString : function(html){ - var results = "Results: \n"; - for(var key in this.timers){ - if(typeof this.timers[key] != 'function'){ - results += key + ":\t" + (this.getElapsed(key) / 1000) + " seconds\n"; - } - } - if(html){ - results = results.replace("\n", '<br>'); - } - return results; - }, - - show : function(){ - alert(this.toString()); - } -}; - -/** - * @class - * Provides a convenient method of performing setTimeout where a new - * timeout cancels the old timeout. An example would be performing validation on a keypress. - * You can use this class to buffer - * the keypress events for a certain number of milliseconds, and perform only if they stop - * for that amount of time. - * @constructor The parameters to this constructor serve as defaults and are not required. - * @param {<i>Function</i>} fn (optional) The default function to timeout - * @param {<i>Object</i>} scope (optional) The default scope of that timeout - * @param {<i>Array</i>} args (optional) The default Array of arguments - */ -YAHOO.ext.util.DelayedTask = function(fn, scope, args){ - var timeoutId = null; - - /** - * Cancels any pending timeout and queues a new one - * @param {Number} delay The milliseconds to delay - * @param {Function} newFn Overrides function passed to constructor - * @param {Object} newScope Overrides scope passed to constructor - * @param {Array} newArgs Overrides args passed to constructor - */ - this.delay = function(delay, newFn, newScope, newArgs){ - if(timeoutId){ - clearTimeout(timeoutId); - } - fn = newFn || fn; - scope = newScope || scope; - args = newArgs || args; - timeoutId = setTimeout(fn.createDelegate(scope, args), delay); - }; - - /** - * Cancel the last queued timeout - */ - this.cancel = function(){ - if(timeoutId){ - clearTimeout(timeoutId); - timeoutId = null; - } - }; -}; - -YAHOO.ext.util.Observable = function(){}; -YAHOO.ext.util.Observable.prototype = { - fireEvent : function(){ - var ce = this.events[arguments[0].toLowerCase()]; - ce.fireDirect.apply(ce, Array.prototype.slice.call(arguments, 1)); - }, - addListener : function(eventName, fn, scope, override){ - eventName = eventName.toLowerCase(); - if(!this.events[eventName]){ - // added for a better message when subscribing to wrong event - throw 'You are trying to listen for an event that does not exist: "' + eventName + '".'; - } - this.events[eventName].subscribe(fn, scope, override); - }, - delayedListener : function(eventName, fn, scope, delay){ - var newFn = function(){ - setTimeout(fn.createDelegate(scope, arguments), delay || 1); - } - this.addListener(eventName, newFn); - return newFn; - }, - removeListener : function(eventName, fn, scope){ - this.events[eventName.toLowerCase()].unsubscribe(fn, scope); - } -}; -YAHOO.ext.util.Observable.prototype.on = YAHOO.ext.util.Observable.prototype.addListener; - -YAHOO.ext.util.Config = { - apply : function(obj, config){ - if(config){ - for(var prop in config){ - if(typeof config[prop] != 'function'){ - obj[prop] = config[prop]; - } - } - } - } -}; - -/** - * @class - */ -YAHOO.ext.util.CSS = new function(){ - var rules = null; - - var toCamel = function(property) { - var convert = function(prop) { - var test = /(-[a-z])/i.exec(prop); - return prop.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase()); - }; - while(property.indexOf('-') > -1) { - property = convert(property); - } - return property; - }; - - /** - * Gets all css rules for the document - */ - this.getRules = function(refreshCache){ - if(rules == null || refreshCache){ - rules = {}; - var ds = document.styleSheets; - for(var i =0, len = ds.length; i < len; i++){ - try{ - var ss = ds[i]; - var ssRules = ss.cssRules || ss.rules; - for(var j = ssRules.length-1; j >= 0; --j){ - rules[ssRules[j].selectorText] = ssRules[j]; - } - }catch(e){} // try catch for cross domain access issue - } - } - return rules; - }; - - /** - * Searches for a rule by selector - */ - this.getRule = function(selector, refreshCache){ - var rs = this.getRules(refreshCache); - if(!(selector instanceof Array)){ - return rs[selector]; - } - for(var i = 0; i < selector.length; i++){ - if(rs[selector[i]]){ - return rs[selector[i]]; - } - } - return null; - }; - - - /** - * Updates a rule property - * @param {String/Array} selector If it's an array it tries each selector until it finds one. Stops immediately once one is found. - */ - this.updateRule = function(selector, property, value){ - if(!(selector instanceof Array)){ - var rule = this.getRule(selector); - if(rule){ - rule.style[property] = value; - return true; - } - }else{ - for(var i = 0; i < selector.length; i++){ - if(this.updateRule(selector[i], property, value)){ - return true; - } - } - } - return false; - }; - - /** - * Applies a rule to an element without adding the class - * @param {String/Array} selector If it's an array it tries each selector until it finds one. Stops immediately once one is found. - */ - this.apply = function(el, selector){ - if(!(selector instanceof Array)){ - var rule = this.getRule(selector); - if(rule){ - var s = rule.style; - for(var key in s){ - if(typeof s[key] != 'function'){ - if(s[key] && String(s[key]).indexOf(':') < 0 && s[key] != 'false'){ - try{el.style[key] = s[key];}catch(e){} - } - } - } - return true; - } - }else{ - for(var i = 0; i < selector.length; i++){ - if(this.apply(el, selector[i])){ - return true; - } - } - } - return false; - }; - - this.applyFirst = function(el, id, selector){ - var selectors = [ - '#' + id + ' ' + selector, - selector - ]; - return this.apply(el, selectors); - }; - - this.revert = function(el, selector){ - if(!(selector instanceof Array)){ - var rule = this.getRule(selector); - if(rule){ - for(key in rule.style){ - if(rule.style[key] && String(rule.style[key]).indexOf(':') < 0 && rule.style[key] != 'false'){ - try{el.style[key] = '';}catch(e){} - } - } - return true; - } - }else{ - for(var i = 0; i < selector.length; i++){ - if(this.revert(el, selector[i])){ - return true; - } - } - } - return false; - }; - - this.revertFirst = function(el, id, selector){ - var selectors = [ - '#' + id + ' ' + selector, - selector - ]; - return this.revert(el, selectors); - }; -}(); - - -/* - * All the Date functions below are the excellent work of Baron Schwartz - */ - -/** @ignore */ -Date.parseFunctions = {count:0}; -/** @ignore */ -Date.parseRegexes = []; -/** @ignore */ -Date.formatFunctions = {count:0}; - -/** - * Formats a date given to the supplied format - the format syntax is the same as <a href="http://www.php.net/date">PHP's date() function</a>. - */ -Date.prototype.dateFormat = function(format) { - if (Date.formatFunctions[format] == null) { - Date.createNewFormat(format); - } - var func = Date.formatFunctions[format]; - return this[func](); -}; - -/** - * Same as {@link #dateFormat} - */ -Date.prototype.format = Date.prototype.dateFormat; - -/** @ignore */ -Date.createNewFormat = function(format) { - var funcName = "format" + Date.formatFunctions.count++; - Date.formatFunctions[format] = funcName; - var code = "Date.prototype." + funcName + " = function(){return "; - var special = false; - var ch = ''; - for (var i = 0; i < format.length; ++i) { - ch = format.charAt(i); - if (!special && ch == "\\") { - special = true; - } - else if (special) { - special = false; - code += "'" + String.escape(ch) + "' + "; - } - else { - code += Date.getFormatCode(ch); - } - } - eval(code.substring(0, code.length - 3) + ";}"); -}; - -/** @ignore */ -Date.getFormatCode = function(character) { - switch (character) { - case "d": - return "String.leftPad(this.getDate(), 2, '0') + "; - case "D": - return "Date.dayNames[this.getDay()].substring(0, 3) + "; - case "j": - return "this.getDate() + "; - case "l": - return "Date.dayNames[this.getDay()] + "; - case "S": - return "this.getSuffix() + "; - case "w": - return "this.getDay() + "; - case "z": - return "this.getDayOfYear() + "; - case "W": - return "this.getWeekOfYear() + "; - case "F": - return "Date.monthNames[this.getMonth()] + "; - case "m": - return "String.leftPad(this.getMonth() + 1, 2, '0') + "; - case "M": - return "Date.monthNames[this.getMonth()].substring(0, 3) + "; - case "n": - return "(this.getMonth() + 1) + "; - case "t": - return "this.getDaysInMonth() + "; - case "L": - return "(this.isLeapYear() ? 1 : 0) + "; - case "Y": - return "this.getFullYear() + "; - case "y": - return "('' + this.getFullYear()).substring(2, 4) + "; - case "a": - return "(this.getHours() < 12 ? 'am' : 'pm') + "; - case "A": - return "(this.getHours() < 12 ? 'AM' : 'PM') + "; - case "g": - return "((this.getHours() %12) ? this.getHours() % 12 : 12) + "; - case "G": - return "this.getHours() + "; - case "h": - return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + "; - case "H": - return "String.leftPad(this.getHours(), 2, '0') + "; - case "i": - return "String.leftPad(this.getMinutes(), 2, '0') + "; - case "s": - return "String.leftPad(this.getSeconds(), 2, '0') + "; - case "O": - return "this.getGMTOffset() + "; - case "T": - return "this.getTimezone() + "; - case "Z": - return "(this.getTimezoneOffset() * -60) + "; - default: - return "'" + String.escape(character) + "' + "; - }; -}; - -/** - * Parses a date given the supplied format - the format syntax is the same as <a href="http://www.php.net/date">PHP's date() function</a>. - */ -Date.parseDate = function(input, format) { - if (Date.parseFunctions[format] == null) { - Date.createParser(format); - } - var func = Date.parseFunctions[format]; - return Date[func](input); -}; - -/** @ignore */ -Date.createParser = function(format) { - var funcName = "parse" + Date.parseFunctions.count++; - var regexNum = Date.parseRegexes.length; - var currentGroup = 1; - Date.parseFunctions[format] = funcName; - - var code = "Date." + funcName + " = function(input){\n" - + "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n" - + "var d = new Date();\n" - + "y = d.getFullYear();\n" - + "m = d.getMonth();\n" - + "d = d.getDate();\n" - + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n" - + "if (results && results.length > 0) {" - var regex = ""; - - var special = false; - var ch = ''; - for (var i = 0; i < format.length; ++i) { - ch = format.charAt(i); - if (!special && ch == "\\") { - special = true; - } - else if (special) { - special = false; - regex += String.escape(ch); - } - else { - obj = Date.formatCodeToRegex(ch, currentGroup); - currentGroup += obj.g; - regex += obj.s; - if (obj.g && obj.c) { - code += obj.c; - } - } - } - - code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n" - + "{return new Date(y, m, d, h, i, s);}\n" - + "else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n" - + "{return new Date(y, m, d, h, i);}\n" - + "else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n" - + "{return new Date(y, m, d, h);}\n" - + "else if (y > 0 && m >= 0 && d > 0)\n" - + "{return new Date(y, m, d);}\n" - + "else if (y > 0 && m >= 0)\n" - + "{return new Date(y, m);}\n" - + "else if (y > 0)\n" - + "{return new Date(y);}\n" - + "}return null;}"; - - Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$"); - eval(code); -}; - -/** @ignore */ -Date.formatCodeToRegex = function(character, currentGroup) { - switch (character) { - case "D": - return {g:0, - c:null, - s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"}; - case "j": - case "d": - return {g:1, - c:"d = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{1,2})"}; - case "l": - return {g:0, - c:null, - s:"(?:" + Date.dayNames.join("|") + ")"}; - case "S": - return {g:0, - c:null, - s:"(?:st|nd|rd|th)"}; - case "w": - return {g:0, - c:null, - s:"\\d"}; - case "z": - return {g:0, - c:null, - s:"(?:\\d{1,3})"}; - case "W": - return {g:0, - c:null, - s:"(?:\\d{2})"}; - case "F": - return {g:1, - c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10);\n", - s:"(" + Date.monthNames.join("|") + ")"}; - case "M": - return {g:1, - c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "]], 10);\n", - s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"}; - case "n": - case "m": - return {g:1, - c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n", - s:"(\\d{1,2})"}; - case "t": - return {g:0, - c:null, - s:"\\d{1,2}"}; - case "L": - return {g:0, - c:null, - s:"(?:1|0)"}; - case "Y": - return {g:1, - c:"y = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{4})"}; - case "y": - return {g:1, - c:"var ty = parseInt(results[" + currentGroup + "], 10);\n" - + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", - s:"(\\d{1,2})"}; - case "a": - return {g:1, - c:"if (results[" + currentGroup + "] == 'am') {\n" - + "if (h == 12) { h = 0; }\n" - + "} else { if (h < 12) { h += 12; }}", - s:"(am|pm)"}; - case "A": - return {g:1, - c:"if (results[" + currentGroup + "] == 'AM') {\n" - + "if (h == 12) { h = 0; }\n" - + "} else { if (h < 12) { h += 12; }}", - s:"(AM|PM)"}; - case "g": - case "G": - case "h": - case "H": - return {g:1, - c:"h = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{1,2})"}; - case "i": - return {g:1, - c:"i = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{2})"}; - case "s": - return {g:1, - c:"s = parseInt(results[" + currentGroup + "], 10);\n", - s:"(\\d{2})"}; - case "O": - return {g:0, - c:null, - s:"[+-]\\d{4}"}; - case "T": - return {g:0, - c:null, - s:"[A-Z]{3}"}; - case "Z": - return {g:0, - c:null, - s:"[+-]\\d{1,5}"}; - default: - return {g:0, - c:null, - s:String.escape(character)}; - } -}; - -Date.prototype.getTimezone = function() { - return this.toString().replace( - /^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace( - /^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3"); -}; - -Date.prototype.getGMTOffset = function() { - return (this.getTimezoneOffset() > 0 ? "-" : "+") - + String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, "0") - + String.leftPad(this.getTimezoneOffset() % 60, 2, "0"); -}; - -Date.prototype.getDayOfYear = function() { - var num = 0; - Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; - for (var i = 0; i < this.getMonth(); ++i) { - num += Date.daysInMonth[i]; - } - return num + this.getDate() - 1; -}; - -Date.prototype.getWeekOfYear = function() { - // Skip to Thursday of this week - var now = this.getDayOfYear() + (4 - this.getDay()); - // Find the first Thursday of the year - var jan1 = new Date(this.getFullYear(), 0, 1); - var then = (7 - jan1.getDay() + 4); - document.write(then); - return String.leftPad(((now - then) / 7) + 1, 2, "0"); -}; - -Date.prototype.isLeapYear = function() { - var year = this.getFullYear(); - return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year))); -}; - -Date.prototype.getFirstDayOfMonth = function() { - var day = (this.getDay() - (this.getDate() - 1)) % 7; - return (day < 0) ? (day + 7) : day; -}; - -Date.prototype.getLastDayOfMonth = function() { - var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7; - return (day < 0) ? (day + 7) : day; -}; - -Date.prototype.getDaysInMonth = function() { - Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; - return Date.daysInMonth[this.getMonth()]; -}; - -/** @ignore */ -Date.prototype.getSuffix = function() { - switch (this.getDate()) { - case 1: - case 21: - case 31: - return "st"; - case 2: - case 22: - return "nd"; - case 3: - case 23: - return "rd"; - default: - return "th"; - } -}; - -if(!String.escape){ - /** @ignore */ - String.escape = function(string) { - return string.replace(/('|\\)/g, "\\$1"); - }; -}; - -/** - * Left pads a string to size with ch - */ -String.leftPad = function (val, size, ch) { - var result = new String(val); - if (ch == null) { - ch = " "; - } - while (result.length < size) { - result = ch + result; - } - return result; -}; - -if(!Object.dump){ -Object.dump = function(o){ - var s = "\n{"; - for(var k in o){ - if(typeof o[k] != 'function'){ - s += "\n\t" + k + ': ' + o[k] +','; - } - } - if(s.length > 3){ - s = s.substring(0, s.length-1); - } - s += "\n}"; - return s; -} -} - -/** @ignore */ -Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; - -/** - * Override these values for international dates, for example... - * Date.monthNames = ['JanInYourLang', 'FebInYourLang', ...]; - */ -Date.monthNames = - ["January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December"]; - -/** - * Override these values for international dates, for example... - * Date.dayNames = ['SundayInYourLang', 'MondayInYourLang', ...]; - */ -Date.dayNames = - ["Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday"]; - -/** @ignore */ -Date.y2kYear = 50; - -/** @ignore */ -Date.monthNumbers = { - Jan:0, - Feb:1, - Mar:2, - Apr:3, - May:4, - Jun:5, - Jul:6, - Aug:7, - Sep:8, - Oct:9, - Nov:10, - Dec:11};-
- - -
- - -| - - File Summary - - | -|
| AbstractColumnModel.js | -- |
| AbstractDataModel.js | -- |
| Actor.js | -- |
| Animator.js | -- |
| CellEditor.js | -- |
| CheckboxEditor.js | -- |
| DateEditor.js | -- |
| DatePicker.js | -- |
| DefaultColumnModel.js | -- |
| DefaultDataModel.js | -- |
| DomHelper.js | -- |
| EditorGrid.js | -- |
| EditorSelectionModel.js | -- |
| Element.js | -- |
| EventManager.js | -- |
| Grid.js | -- |
| GridDD.js | -- |
| GridView.js | -- |
| JSONDataModel.js | -- |
| LoadableDataModel.js | -- |
| NumberEditor.js | -- |
| PagedGridView.js | -- |
| Resizable.js | -- |
| SelectEditor.js | -- |
| SelectionModel.js | -- |
| SplitBar.js | -- |
| State.js | -- |
| TabPanel.js | -- |
| TextEditor.js | -- |
| Toolbar.js | -- |
| UpdateManager.js | -- |
| XMLDataModel.js | -- |
| yutil.js | -- |
-
-
|
-- - | -||||||||
| - PREV - NEXT | -- FRAMES - NO FRAMES - - - - | -||||||||
-
-
|
-- - | -|||||||
| - PREV - NEXT | -- FRAMES - NO FRAMES - - - - | -|||||||
- * var el = YAHOO.ext.Element.get('myElementId');
- * // or the shorter
- * var el = getEl('myElementId');
- *
- * Using YAHOO.ext.Element.get() instead of calling the constructor directly ensures you get the same object
- * each call instead of constructing a new one.
- fu<>nction handleClick(e){ // e is not a standard event object, it is a YAHOO.ext.EventObject
- e.preventDefault();
- var target = e.getTarget();
- ...
- }
- var myDiv = getEl('myDiv');
- myDiv.mon('click', handleClick);
- //or
- YAHOO.ext.EventManager.on('myDiv', 'click', handleClick);
- YAHOO.ext.EventManager.addListener('myDiv', 'click', handleClick);
-
- */
-YAHOO.ext.EventObject = new function(){
- /** The normal browser event */
- this.browserEvent = null;
- /** The button pressed in a mouse event */
- this.button = -1;
- /** True if the shift key was down during the event */
- this.shiftKey = false;
- /** True if the control key was down during the event */
- this.ctrlKey = false;
- /** True if the alt key was down during the event */
- this.altKey = false;
-
- /** Key constant @type Number */
- this.BACKSPACE = 8;
- /** Key constant @type Number */
- this.TAB = 9;
- /** Key constant @type Number */
- this.RETURN = 13;
- /** Key constant @type Number */
- this.ESC = 27;
- /** Key constant @type Number */
- this.SPACE = 32;
- /** Key constant @type Number */
- this.PAGEUP = 33;
- /** Key constant @type Number */
- this.PAGEDOWN = 34;
- /** Key constant @type Number */
- this.END = 35;
- /** Key constant @type Number */
- this.HOME = 36;
- /** Key constant @type Number */
- this.LEFT = 37;
- /** Key constant @type Number */
- this.UP = 38;
- /** Key constant @type Number */
- this.RIGHT = 39;
- /** Key constant @type Number */
- this.DOWN = 40;
- /** Key constant @type Number */
- this.DELETE = 46;
- /** Key constant @type Number */
- this.F5 = 116;
-
- /** @private */
- this.setEvent = function(e){
- this.browserEvent = e;
- if(e){
- this.button = e.button;
- this.shiftKey = e.shiftKey;
- this.ctrlKey = e.ctrlKey;
- this.altKey = e.altKey;
- }else{
- this.button = -1;
- this.shiftKey = false;
- this.ctrlKey = false;
- this.altKey = false;
- }
- };
-
- /**
- * Stop the event. Calls YAHOO.util.Event.stopEvent() if the event is not null.
- */
- this.stopEvent = function(){
- if(this.browserEvent){
- YAHOO.util.Event.stopEvent(this.browserEvent);
- }
- };
-
- /**
- * Prevents the browsers default handling of the event. Calls YAHOO.util.Event.preventDefault() if the event is not null.
- */
- this.preventDefault = function(){
- if(this.browserEvent){
- YAHOO.util.Event.preventDefault(this.browserEvent);
- }
- };
-
- /** @private */
- this.isNavKeyPress = function(){
- return (this.browserEvent.keyCode && this.browserEvent.keyCode >= 33 && this.browserEvent.keyCode <= 40);
- };
-
- /**
- * Cancels bubbling of the event. Calls YAHOO.util.Event.stopPropagation() if the event is not null.
- */
- this.stopPropagation = function(){
- if(this.browserEvent){
- YAHOO.util.Event.stopPropagation(this.browserEvent);
- }
- };
-
- /**
- * Gets the key code for the event. Returns value from YAHOO.util.Event.getCharCode() if the event is not null.
- * @return {Number}
- */
- this.getCharCode = function(){
- if(this.browserEvent){
- return YAHOO.util.Event.getCharCode(this.browserEvent);
- }
- return null;
- };
-
- /**
- * Gets the x coordinate of the event. Returns value from YAHOO.util.Event.getPageX() if the event is not null.
- * @return {Number}
- */
- this.getPageX = function(){
- if(this.browserEvent){
- return YAHOO.util.Event.getPageX(this.browserEvent);
- }
- return null;
- };
-
- /**
- * Gets the y coordinate of the event. Returns value from YAHOO.util.Event.getPageY() if the event is not null.
- * @return {Number}
- */
- this.getPageY = function(){
- if(this.browserEvent){
- return YAHOO.util.Event.getPageY(this.browserEvent);
- }
- return null;
- };
-
- /**
- * Gets the time of the event. Returns value from YAHOO.util.Event.getTime() if the event is not null.
- * @return {Number}
- */
- this.getTime = function(){
- if(this.browserEvent){
- return YAHOO.util.Event.getTime(this.browserEvent);
- }
- return null;
- };
-
- /**
- * Gets the page coordinates of the event. Returns value from YAHOO.util.Event.getXY() if the event is not null.
- * @return {Array} The xy values like [x, y]
- */
- this.getXY = function(){
- if(this.browserEvent){
- return YAHOO.util.Event.getXY(this.browserEvent);
- }
- return [];
- };
-
- /**
- * Gets the target for the event. Returns value from YAHOO.util.Event.getTarget() if the event is not null.
- * @return {HTMLelement}
- */
- this.getTarget = function(){
- if(this.browserEvent){
- return YAHOO.util.Event.getTarget(this.browserEvent);
- }
- return null;
- };
-
- /**
- * Walk up the DOM looking for a particular target - if the default target matches, it is returned.
- * @return {HTMLelement}
- */
- this.findTarget = function(className, tagName){
- if(tagName) tagName = tagName.toLowerCase();
- if(this.browserEvent){
- function isMatch(el){
- if(!el){
- return false;
- }
- if(className && !YAHOO.util.Dom.hasClass(el, className)){
- return false;
- }
- if(tagName && el.tagName.toLowerCase() != tagName){
- return false;
- }
- return true;
- };
-
- var t = this.getTarget();
- if(!t || isMatch(t)){
- return t;
- }
- var p = t.parentNode;
- while(p && p.tagName.toUpperCase() != 'BODY'){
- if(isMatch(p)){
- return p;
- }
- p = p.parentNode;
- }
- }
- return null;
- };
- /**
- * Gets the related target. Returns value from YAHOO.util.Event.getRelatedTarget() if the event is not null.
- * @return {HTMLelement}
- */
- this.getRelatedTarget = function(){
- if(this.browserEvent){
- return YAHOO.util.Event.getRelatedTarget(this.browserEvent);
- }
- return null;
- };
-
- /**
- * Normalizes mouse wheel delta across browsers
- */
- this.getWheelDelta = function(){
- var e = this.browserEvent;
- var delta = 0;
- if(e.wheelDelta){ /* IE/Opera. */
- delta = e.wheelDelta/120;
- /** In Opera 9, delta differs in sign as compared to IE. */
- if(window.opera) delta = -delta;
- }else if(e.detail){ /** Mozilla case. */
- delta = -e.detail/3;
- }
- return delta;
- };
-
- /**
- * Returns true if the control, shift or alt key was pressed during this event.
- * @return {Boolean}
- */
- this.hasModifier = function(){
- return this.ctrlKey || this.altKey || this.shiftKey;
- };
-}();
-
-
\ No newline at end of file
diff --git a/www/extras/yui-ext/source/State.js b/www/extras/yui-ext/source/State.js
deleted file mode 100644
index 2ca43feb4..000000000
--- a/www/extras/yui-ext/source/State.js
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-YAHOO.namespace('ext.state');
-
-YAHOO.ext.state.Provider = function(){
- YAHOO.ext.state.Provider.superclass.constructor.call(this);
- this.events = {
- 'statechange': new YAHOO.util.CustomEvent('statechange')
- };
- this.state = {};
-};
-YAHOO.extendX(YAHOO.ext.state.Provider, YAHOO.ext.util.Observable, {
- get : function(name){
- return this.state[name];
- },
-
- clear : function(name){
- delete this.state[name];
- this.fireEvent('statechange', this, name, null);
- },
-
- set : function(name, value){
- this.state[name] = value;
- this.fireEvent('statechange', this, name, value);
- }
-});
-
-YAHOO.ext.state.Manager = new function(){
- var provider = new YAHOO.ext.state.Provider();
-
- return {
- setProvider : function(stateProvider){
- provider = stateProvider;
- },
-
- get : function(key){
- return provider.get(key);
- },
-
- set : function(key, value){
- provider.set(key, value);
- },
-
- clear : function(key){
- provider.clear(key);
- },
-
- getProvider : function(){
- return provider;
- }
- };
-}();
-
-YAHOO.ext.state.CookieProvider = function(config){
- YAHOO.ext.state.CookieProvider.superclass.constructor.call(this);
- this.path = '/';
- this.expires = new Date(new Date().getTime()+(1000*60*60*24*7)); //7 days
- this.domain = null;
- this.secure = false;
- YAHOO.ext.util.Config.apply(this, config);
- this.state = this.readCookies();
-};
-
-YAHOO.extendX(YAHOO.ext.state.CookieProvider, YAHOO.ext.state.Provider, {
- set : function(name, value){
- if(typeof value == 'undefined' || value === null){
- this.clear(name);
- return;
- }
- this.setCookie(name, value);
- YAHOO.ext.state.CookieProvider.superclass.set.call(this, name, value);
- },
-
- clear : function(name){
- this.clearCookie(name);
- YAHOO.ext.state.CookieProvider.superclass.clear.call(this, name);
- },
-
- readCookies : function(){
- var cookies = {};
- var c = document.cookie + ';';
- var re = /\s?(.*?)=(.*?);/g;
- var matches;
- while((matches = re.exec(c)) != null){
- var name = matches[1];
- var value = matches[2];
- if(name && name.substring(0,3) == 'ys-'){
- cookies[name.substr(3)] = this.decodeValue(value);
- }
- }
- return cookies;
- },
-
- decodeValue : function(cookie){
- var re = /^(a|n|d|b|s|o)\:(.*)$/;
- var matches = re.exec(unescape(cookie));
- if(!matches || !matches[1]) return; // non state cookie
- var type = matches[1];
- var v = matches[2];
- switch(type){
- case 'n':
- return parseFloat(v);
- case 'd':
- return new Date(Date.parse(v));
- case 'b':
- return (v == '1');
- case 'a':
- var all = [];
- var values = v.split('^');
- for(var i = 0, len = values.length; i < len; i++){
- all.push(this.decodeValue(values[i]))
- }
- return all;
- case 'o':
- var all = {};
- var values = v.split('^');
- for(var i = 0, len = values.length; i < len; i++){
- var kv = values[i].split('=');
- all[kv[0]] = this.decodeValue(kv[1]);
- }
- return all;
- default:
- return v;
- }
- },
-
- encodeValue : function(v){
- var enc;
- if(typeof v == 'number'){
- enc = 'n:' + v;
- }else if(typeof v == 'boolean'){
- enc = 'b:' + (v ? '1' : '0');
- }else if(v instanceof Date){
- enc = 'd:' + v.toGMTString();
- }else if(v instanceof Array){
- var flat = '';
- for(var i = 0, len = v.length; i < len; i++){
- flat += this.encodeValue(v[i]);
- if(i != len-1) flat += '^';
- }
- enc = 'a:' + flat;
- }else if(typeof v == 'object'){
- var flat = '';
- for(var key in v){
- if(typeof v[key] != 'function'){
- flat += key + '=' + this.encodeValue(v[key]) + '^';
- }
- }
- enc = 'o:' + flat.substring(0, flat.length-1);
- }else{
- enc = 's:' + v;
- }
- return escape(enc);
- },
-
- setCookie : function(name, value){
- document.cookie = "ys-"+ name + "=" + this.encodeValue(value) +
- ((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) +
- ((this.path == null) ? "" : ("; path=" + this.path)) +
- ((this.domain == null) ? "" : ("; domain=" + this.domain)) +
- ((this.secure == true) ? "; secure" : "");
- },
-
- clearCookie : function(name){
- document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" +
- ((this.path == null) ? "" : ("; path=" + this.path)) +
- ((this.domain == null) ? "" : ("; domain=" + this.domain)) +
- ((this.secure == true) ? "; secure" : "");
- }
-});
diff --git a/www/extras/yui-ext/source/UpdateManager.js b/www/extras/yui-ext/source/UpdateManager.js
deleted file mode 100644
index dd04e1360..000000000
--- a/www/extras/yui-ext/source/UpdateManager.js
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-/**
- * @class Provides AJAX-style update for Element object using Yahoo
- * UI library YAHOO.util.Connect functionality.
- * // Get it from a YAHOO.ext.Element object
- * var mgr = myElement.getUpdateManager();
- * mgr.update('http://myserver.com/index.php', 'param1=1¶m2=2');
- * ...
- * mgr.formUpdate('myFormId', 'http://myserver.com/index.php');
- *
- * // or directly (returns the same UpdateManager instance)
- * var mgr = new YAHOO.ext.UpdateManager('myElementId');
- * mgr.startAutoRefresh('http://myserver.com/index.php', 60);
- * mgr.onUpdate.subscribe(myFcnNeedsToKnow);
- *
- *
- * @requires YAHOO.ext.Element
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @requires YAHOO.util.Connect
- * @constructor
- * Create new UpdateManager.
- * @param {String/HTMLElement/YAHOO.ext.Element} el The element to update
- * @param {Boolean} forceNew (optional) By default the constructor checks to see if the passed element already has an UpdateManager and if it does it returns the same instance. This will skip that check (useful for extending this class).
- */
-YAHOO.ext.UpdateManager = function(el, forceNew){
- el = YAHOO.ext.Element.get(el);
- if(!forceNew && el.updateManager){
- return el.updateManager;
- }
- /**
- * The Element object
- * @type YAHOO.ext.Element
- */
- this.el = el;
- /**
- * Cached url to use for refreshes. Overwritten every time update() is called unless 'discardUrl' param is set to true.
- * @type String
- */
- this.defaultUrl = null;
- /**
- * fired before update is made, return false from your handler and the update is cancelled.
- * Uses fireDirect with signature: (oElement, url, params)
- * @type YAHOO.util.CustomEvent
- */
- this.beforeUpdate = new YAHOO.util.CustomEvent('UpdateManager.beforeUpdate');
- /**
- * Fired after successful update is made. Uses fireDirect with signature: (oElement, oResponseObject)
- * @type YAHOO.util.CustomEvent
- */
- this.onUpdate = new YAHOO.util.CustomEvent('UpdateManager.onUpdate');
- /**
- * Fired on update failure. Uses fireDirect with signature: (oElement, oResponseObject)
- * @type YAHOO.util.CustomEvent
- */
- this.onFailure = new YAHOO.util.CustomEvent('UpdateManager.onFailure');
-
- /**
- * Blank page URL to use with SSL file uploads (Defaults to YAHOO.ext.UpdateManager.defaults.sslBlankUrl or 'about:blank').
- * @type String
- */
- this.sslBlankUrl = YAHOO.ext.UpdateManager.defaults.sslBlankUrl;
- /**
- * Whether to append unique parameter on get request to disable caching (Defaults to YAHOO.ext.UpdateManager.defaults.disableCaching or false).
- * @type Boolean
- */
- this.disableCaching = YAHOO.ext.UpdateManager.defaults.disableCaching;
- /**
- * Text for loading indicator (Defaults to YAHOO.ext.UpdateManager.defaults.indicatorText or '<div class="loading-indicator">Loading...</div>').
- * @type String
- */
- this.indicatorText = YAHOO.ext.UpdateManager.defaults.indicatorText;
- /**
- * Whether to show indicatorText when loading (Defaults to YAHOO.ext.UpdateManager.defaults.showLoadIndicator or true).
- * @type String
- */
- this.showLoadIndicator = YAHOO.ext.UpdateManager.defaults.showLoadIndicator;
- /**
- * Timeout for requests or form posts in seconds (Defaults to YAHOO.ext.UpdateManager.defaults.timeout or 30 seconds).
- * @type Number
- */
- this.timeout = YAHOO.ext.UpdateManager.defaults.timeout;
-
- /**
- * True to process scripts in the output (Defaults to YAHOO.ext.UpdateManager.defaults.loadScripts (false)).
- * @type Number
- */
- this.loadScripts = YAHOO.ext.UpdateManager.defaults.loadScripts;
-
- /**
- * YAHOO.util.Connect transaction object of current executing transaction
- */
- this.transaction = null;
-
- /**
- * @private
- */
- this.autoRefreshProcId = null;
- /**
- * Delegate for refresh() prebound to 'this', use myUpdater.refreshDelegate.createCallback(arg1, arg2) to bind arguments
- * @type Function
- */
- this.refreshDelegate = this.refresh.createDelegate(this);
- /**
- * Delegate for update() prebound to 'this', use myUpdater.updateDelegate.createCallback(arg1, arg2) to bind arguments
- * @type Function
- */
- this.updateDelegate = this.update.createDelegate(this);
- /**
- * Delegate for formUpdate() prebound to 'this', use myUpdater.formUpdateDelegate.createCallback(arg1, arg2) to bind arguments
- * @type Function
- */
- this.formUpdateDelegate = this.formUpdate.createDelegate(this);
- /**
- * @private
- */
- this.successDelegate = this.processSuccess.createDelegate(this);
- /**
- * @private
- */
- this.failureDelegate = this.processFailure.createDelegate(this);
-
- /**
- * The renderer for this UpdateManager. Defaults to {@link YAHOO.ext.UpdateManager.BasicRenderer}.
- */
- this.renderer = new YAHOO.ext.UpdateManager.BasicRenderer();
-};
-
-YAHOO.ext.UpdateManager.prototype = {
- /**
- * Get the Element this UpdateManager is bound to
- * @return {YAHOO.ext.Element} The element
- */
- getEl : function(){
- return this.el;
- },
-
- /**
- * Performs an async request, updating this element with the response. If params are specified it uses POST, otherwise it uses GET.
- * @param {String/Function} url The url for this request or a function to call to get the url
- * @param {String/Object} params (optional) The parameters to pass as either a url encoded string "param1=1¶m2=2" or as an object {param1: 1, param2: 2}
- * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- * @param {Boolean} discardUrl (optional) By default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url.
- */
- update : function(url, params, callback, discardUrl){
- if(this.beforeUpdate.fireDirect(this.el, url, params) !== false){
- this.showLoading();
- if(!discardUrl){
- this.defaultUrl = url;
- }
- if(typeof url == 'function'){
- url = url();
- }
- if(params && typeof params != 'string'){ // must be object
- var buf = [];
- for(var key in params){
- if(typeof params[key] != 'function'){
- buf.push(encodeURIComponent(key), '=', encodeURIComponent(params[key]), '&');
- }
- }
- delete buf[buf.length-1];
- params = buf.join('');
- }
- var callback = {
- success: this.successDelegate,
- failure: this.failureDelegate,
- timeout: (this.timeout*1000),
- argument: {'url': url, 'form': null, 'callback': callback, 'params': params}
- };
- var method = params ? 'POST' : 'GET';
- if(method == 'GET'){
- url = this.prepareUrl(url);
- }
- this.transaction = YAHOO.util.Connect.asyncRequest(method, url, callback, params);
- }
- },
-
- /**
- * Performs an async form post, updating this element with the response. If the form has the attribute enctype="multipart/form-data", it assumes it's a file upload.
- * Uses this.sslBlankUrl for SSL file uploads to prevent IE security warning. See YUI docs for more info.
- * @param {String/HTMLElement} form The form Id or form element
- * @param {String} url (optional) The url to pass the form to. If omitted the action attribute on the form will be used.
- * @param {Boolean} reset (optional) Whether to try to reset the form after the update
- * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- */
- formUpdate : function(form, url, reset, callback){
- if(this.beforeUpdate.fireDirect(this.el, form, url) !== false){
- this.showLoading();
- formEl = YAHOO.util.Dom.get(form);
- if(typeof url == 'function'){
- url = url();
- }
- url = url || formEl.action;
- var callback = {
- success: this.successDelegate,
- failure: this.failureDelegate,
- timeout: (this.timeout*1000),
- argument: {'url': url, 'form': form, 'callback': callback, 'reset': reset}
- };
- var isUpload = false;
- var enctype = formEl.getAttribute('enctype');
- if(enctype && enctype.toLowerCase() == 'multipart/form-data'){
- isUpload = true;
- }
- YAHOO.util.Connect.setForm(form, isUpload, this.sslBlankUrl);
- this.transaction = YAHOO.util.Connect.asyncRequest('POST', url, callback);
- }
- },
-
- /**
- * Refresh the element with the last used url or defaultUrl. If there is no url, it returns immediately
- * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- */
- refresh : function(callback){
- if(this.defaultUrl == null){
- return;
- }
- this.update(this.defaultUrl, null, callback, true);
- },
-
- /**
- * Set this element to auto refresh.
- * @param {Number} interval How often to update (in seconds).
- * @param {String/Function} url (optional) The url for this request or a function to call to get the url (Defaults to the last used url)
- * @param {String/Object} params (optional) The parameters to pass as either a url encoded string "¶m1=1¶m2=2" or as an object {param1: 1, param2: 2}
- * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
- * @param {Boolean} refreshNow (optional) Whether to execute the refresh now, or wait the interval
- */
- startAutoRefresh : function(interval, url, params, callback, refreshNow){
- if(refreshNow){
- this.update(url || this.defaultUrl, params, callback, true);
- }
- if(this.autoRefreshProcId){
- clearInterval(this.autoRefreshProcId);
- }
- this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
- },
-
- /**
- * Stop auto refresh on this element.
- */
- stopAutoRefresh : function(){
- if(this.autoRefreshProcId){
- clearInterval(this.autoRefreshProcId);
- }
- },
-
- /**
- * Called to update the element to "Loading" state. Override to perform custom action.
- */
- showLoading : function(){
- if(this.showLoadIndicator){
- this.el.update(this.indicatorText);
- }
- },
-
- /**
- * Adds unique parameter to query string if disableCaching = true
- * @private
- */
- prepareUrl : function(url){
- if(this.disableCaching){
- var append = '_dc=' + (new Date().getTime());
- if(url.indexOf('?') !== -1){
- url += '&' + append;
- }else{
- url += '?' + append;
- }
- }
- return url;
- },
-
- /**
- * @private
- */
- processSuccess : function(response){
- this.transaction = null;
- this.renderer.render(this.el, response, this);
- if(response.argument.form && response.argument.reset){
- try{ // put in try/catch since some older FF releases had problems with this
- response.argument.form.reset();
- }catch(e){}
- }
- this.onUpdate.fireDirect(this.el, response);
- if(typeof response.argument.callback == 'function'){
- response.argument.callback(this.el, true);
- }
- },
-
- /**
- * @private
- */
- processFailure : function(response){
- this.transaction = null;
- this.onFailure.fireDirect(this.el, response);
- if(typeof response.argument.callback == 'function'){
- response.argument.callback(this.el, false);
- }
- },
-
- /**
- * Set the content renderer for this UpdateManager. See {@link YAHOO.ext.UpdateManager.BasicRenderer#render} for more details.
- * @param {Object} renderer The object implementing the render() method
- */
- setRenderer : function(renderer){
- this.renderer = renderer;
- },
-
- getRenderer : function(){
- return this.renderer;
- },
-
- /**
- * Set the defaultUrl used for updates
- * @param {String/Function} defaultUrl The url or a function to call to get the url
- */
- setDefaultUrl : function(defaultUrl){
- this.defaultUrl = defaultUrl;
- },
-
- /**
- * Aborts the executing transaction
- */
- abort : function(){
- if(this.transaction){
- YAHOO.util.Connect.abort(this.transaction);
- }
- },
-
- /**
- * Returns true if an update is in progress
- */
- isUpdating : function(){
- if(this.transaction){
- return YAHOO.util.Connect.isCallInProgress(this.transaction);
- }
- return false;
- }
-};
-
-/**
- * Static convenience method, Usage:
- * YAHOO.ext.UpdateManager.update('my-div', 'stuff.php');
- * @param {String/HTMLElement/YAHOO.ext.Element} el The element to update
- * @param {String} url The url
- * @param {String/Object} params (optional) Url encoded param string or an object of name/value pairs
- * @param {Object} options (optional) A config object with any of the UpdateManager properties you want to set - for example: {disableCaching:true, indicatorText: 'Loading data...'}
- */
-YAHOO.ext.UpdateManager.update = function(el, url, params, options){
- var um = getEl(el, true).getUpdateManager();
- YAHOO.ext.util.Config.apply(um, options);
- um.update(url, params, options.callback);
-}
-
-/**
- * @class
- * Default Content renderer. Updates the elements innerHTML with the responseText.
- */
-YAHOO.ext.UpdateManager.BasicRenderer = function(){};
-
-YAHOO.ext.UpdateManager.BasicRenderer.prototype = {
- /**
- * This is called when the transaction is completed and it's time to update the element - The BasicRenderer
- * updates the elements innerHTML with the responseText - To perform a custom render (i.e. XML or JSON processing),
- * create an object with a "render(el, response)" method and pass it to setRenderer on the UpdateManager.
- * @param {YAHOO.ext.Element} el The element being rendered
- * @param {Object} response The YUI Connect response object
- */
- render : function(el, response, updateManager){
- el.update(response.responseText, updateManager.loadScripts);
- }
-};
-
-/**
- * The defaults collection enables customizing the default behavior of UpdateManager
- */
-YAHOO.ext.UpdateManager.defaults = {};
-/**
- * Timeout for requests or form posts in seconds (Defaults 30 seconds).
- * @type Number
- */
- YAHOO.ext.UpdateManager.defaults.timeout = 30;
- /**
- * True to process scripts by default (Defaults to false).
- * @type Number
- */
- YAHOO.ext.UpdateManager.defaults.loadScripts = false;
-
-/**
-* Blank page URL to use with SSL file uploads (Defaults to 'about:blank').
-* @type String
-*/
-YAHOO.ext.UpdateManager.defaults.sslBlankUrl = 'about:blank';
-/**
- * Whether to append unique parameter on get request to disable caching (Defaults to false).
- * @type Boolean
- */
-YAHOO.ext.UpdateManager.defaults.disableCaching = false;
-/**
- * Whether to show indicatorText when loading (Defaults to true).
- * @type String
- */
-YAHOO.ext.UpdateManager.defaults.showLoadIndicator = true;
-/**
- * Text for loading indicator (Defaults to '<div class="loading-indicator">Loading...</div>').
- * @type String
- */
-YAHOO.ext.UpdateManager.defaults.indicatorText = '
- * var actor = new YAHOO.ext.Actor('myElementId');
- * actor.startCapture(true);
- * actor.moveTo(100, 100, true);
- * actor.squish();
- * actor.play();
- *
- * // or to start capturing immediately, with no Animator (the null second param)
- *
- * var actor = new YAHOO.ext.Actor('myElementId', null, true);
- * actor.moveTo(100, 100, true);
- * actor.squish();
- * actor.play();
- *
- * @extends YAHOO.ext.Element
- * @requires YAHOO.ext.Element
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @requires YAHOO.util.Anim
- * @requires YAHOO.util.ColorAnim
- * @requires YAHOO.util.Motion
- * @className YAHOO.ext.Actor
- * @constructor
- * Create new Actor.
- * @param {String/HTMLElement} el The dom element or element id
- * @param {YAHOO.ext.Animator} animator (optional) The Animator that will capture this Actor's actions
- * @param {Boolean} selfCapture (optional) Whether this actor should capture it's own actions to support self playback without an animator (defaults to false)
- */
-YAHOO.ext.Actor = function(element, animator, selfCapture){
- YAHOO.ext.Actor.superclass.constructor.call(this, element, true);
-
- this.el = YAHOO.ext.Element.get(this.id); // cache el object for playback
-
- this.onCapture = new YAHOO.util.CustomEvent('Actor.onCapture');
- if(animator){
- /**
- * The animator used to sync this actor with other actors
- * @member YAHOO.ext.Actor
- */
- animator.addActor(this);
- }
- /**
- * Whether this actor is currently capturing
- * @member YAHOO.ext.Actor
- */
- this.capturing = selfCapture;
- this.playlist = selfCapture ? new YAHOO.ext.Animator.AnimSequence() : null;
-};
-
-YAHOO.extendX(YAHOO.ext.Actor, YAHOO.ext.Element);
-
-/**
- * Captures an action for this actor. Generally called internally but can be called directly.
- # @param {YAHOO.ext.Actor.Action} action
- */
-YAHOO.ext.Actor.prototype.capture = function(action){
- if(this.playlist != null){
- this.playlist.add(action);
- }
- this.onCapture.fireDirect(this, action);
- return action;
-};
-
-/** @ignore */
-YAHOO.ext.Actor.overrideAnimation = function(method, animParam, onParam){
- return function(){
- if(!this.capturing){
- return method.apply(this, arguments);
- }
- var args = Array.prototype.slice.call(arguments, 0);
- if(args[animParam] === true){
- return this.capture(new YAHOO.ext.Actor.AsyncAction(this, method, args, onParam));
- }else{
- return this.capture(new YAHOO.ext.Actor.Action(this, method, args));
- }
- };
-}
-
-/** @ignore */
-YAHOO.ext.Actor.overrideBasic = function(method){
- return function(){
- if(!this.capturing){
- return method.apply(this, arguments);
- }
- var args = Array.prototype.slice.call(arguments, 0);
- return this.capture(new YAHOO.ext.Actor.Action(this, method, args));
- };
-}
-
-// All of these methods below are marked "ignore" because JSDoc treats them as fields, not function. How brilliant. The Element methods are documented anyway though.
-/** Capturing override - See {@link YAHOO.ext.Element#setVisibilityMode} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setVisibilityMode = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setVisibilityMode);
-/** Capturing override - See {@link YAHOO.ext.Element#enableDisplayMode} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.enableDisplayMode = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.enableDisplayMode);
-/** Capturing override - See {@link YAHOO.ext.Element#focus} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.focus = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.focus);
-/** Capturing override - See {@link YAHOO.ext.Element#addClass} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.addClass = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.addClass);
-/** Capturing override - See {@link YAHOO.ext.Element#removeClass} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.removeClass = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.removeClass);
-/** Capturing override - See {@link YAHOO.ext.Element#replaceClass} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.replaceClass = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.replaceClass);
-/** Capturing override - See {@link YAHOO.ext.Element#setStyle} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setStyle = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setStyle);
-/** Capturing override - See {@link YAHOO.ext.Element#setX} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setX = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setX);
-/** Capturing override - See {@link YAHOO.ext.Element#setY} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setY = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setY);
-/** Capturing override - See {@link YAHOO.ext.Element#setLeft} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setLeft = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setLeft);
-/** Capturing override - See {@link YAHOO.ext.Element#setTop} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setTop = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setTop);
-/** Capturing override - See {@link YAHOO.ext.Element#setAbsolutePositioned} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setAbsolutePositioned = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setAbsolutePositioned);
-/** Capturing override - See {@link YAHOO.ext.Element#setRelativePositioned} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setRelativePositioned = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setRelativePositioned);
-/** Capturing override - See {@link YAHOO.ext.Element#clearPositioning} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.clearPositioning = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clearPositioning);
-/** Capturing override - See {@link YAHOO.ext.Element#setPositioning} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setPositioning = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.setPositioning);
-/** Capturing override - See {@link YAHOO.ext.Element#clip} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.clip = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clip);
-/** Capturing override - See {@link YAHOO.ext.Element#unclip} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.unclip = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.unclip);
-/** Capturing override - See {@link YAHOO.ext.Element#clearOpacity} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.clearOpacity = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.clearOpacity);
-/** Capturing override - See {@link YAHOO.ext.Element#clearOpacity} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.update = YAHOO.ext.Actor.overrideBasic(YAHOO.ext.Actor.superclass.update);
-
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#animate} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.animate = function(args, duration, onComplete, easing, animType){
- if(!this.capturing){
- return YAHOO.ext.Actor.superclass.animate.apply(this, arguments);
- }
- return this.capture(new YAHOO.ext.Actor.AsyncAction(this, YAHOO.ext.Actor.superclass.animate,
- [args, duration, onComplete, easing, animType], 2));
-};
-
-/** Capturing and animation syncing override - See {@link YAHOO.ext.Element#setVisible} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setVisible = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setVisible, 1, 3);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#toggle} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.toggle = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.toggle, 0, 2);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setXY} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setXY = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setXY, 1, 3);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setLocation} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setLocation = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setLocation, 2, 4);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setWidth} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setWidth = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setWidth, 1, 3);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setHeight} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setHeight = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setHeight, 1, 3);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setSize} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setSize = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setSize, 2, 4);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setBounds} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setBounds = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setBounds, 4, 6);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#setHeight} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.setOpacity = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.setHeight, 1, 3);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#moveTo} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.moveTo = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.moveTo, 2, 4);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#move} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.move = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.move, 2, 4);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#alignTo} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.alignTo = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.alignTo, 3, 5);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#hide} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.hide = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.hide, 0, 2);
-/**Capturing and animation syncing override - See {@link YAHOO.ext.Element#show} for method details.
- * @type Function */
-YAHOO.ext.Actor.prototype.show = YAHOO.ext.Actor.overrideAnimation(YAHOO.ext.Actor.superclass.show, 0, 2);
-
-/**
- * Start self capturing calls on this Actor. All subsequent calls are captured and executed when play() is called.
- */
-YAHOO.ext.Actor.prototype.startCapture = function(){
- this.capturing = true;
- this.playlist = new YAHOO.ext.Animator.AnimSequence();
- };
-
- /**
- * Stop self capturing calls on this Actor.
- */
- YAHOO.ext.Actor.prototype.stopCapture = function(){
- this.capturing = false;
- };
-
-/**
- * Clears any calls that have been self captured.
- */
-YAHOO.ext.Actor.prototype.clear = function(){
- this.playlist = new YAHOO.ext.Animator.AnimSequence();
-};
-
-/**
- * Starts playback of self captured calls.
- * @param {Function} oncomplete (optional) Callback to execute when playback has completed
- */
-YAHOO.ext.Actor.prototype.play = function(oncomplete){
- this.capturing = false;
- if(this.playlist){
- this.playlist.play(oncomplete);
- }
- };
-
-/**
- * Capture a function call.
- * @param {Function} fcn The function to call
- * @param {Array} args (optional) The arguments to call the function with
- * @param {Object} scope (optional) The scope of the function
- */
-YAHOO.ext.Actor.prototype.addCall = function(fcn, args, scope){
- this.capture(new YAHOO.ext.Actor.Action(scope, fcn, args || []));
-};
-
-/**
- * Capture an async function call.
- * @param {Function} fcn The function to call
- * @param {Number} callbackIndex The index of the callback parameter on the passed function. A CALLBACK IS REQUIRED.
- * @param {Array} args The arguments to call the function with
- * @param {Object} scope (optional) The scope of the function
- */
-YAHOO.ext.Actor.prototype.addAsyncCall = function(fcn, callbackIndex, args, scope){
- this.capture(new YAHOO.ext.Actor.AsyncAction(scope, fcn, args || [], callbackIndex));
- },
-
-/**
- * Capture a pause (in seconds).
- * @param {Number} seconds The seconds to pause
- */
-YAHOO.ext.Actor.prototype.pause = function(seconds){
- this.capture(new YAHOO.ext.Actor.PauseAction(seconds));
- };
-
-/**
-* Shake this element from side to side
-*/
-YAHOO.ext.Actor.prototype.shake = function(){
- this.move('left', 20, true, .05);
- this.move('right', 40, true, .05);
- this.move('left', 40, true, .05);
- this.move('right', 20, true, .05);
-};
-
-/**
-* Bounce this element from up and down
-*/
-YAHOO.ext.Actor.prototype.bounce = function(){
- this.move('up', 20, true, .05);
- this.move('down', 40, true, .05);
- this.move('up', 40, true, .05);
- this.move('down', 20, true, .05);
-};
-
-/**
-* Show the element using a "blinds" effect
-* @param {String} anchor The part of the element that it should appear to exapand from.
- The short/long options currently are t/top, l/left
-* @param {Number} newSize (optional) The size to animate to. (Default to current size)
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-* @param {Function} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut)
-*/
-YAHOO.ext.Actor.prototype.blindShow = function(anchor, newSize, duration, easing){
- var size = newSize || this.getSize();
- this.clip();
- this.setVisible(true);
- anchor = anchor.toLowerCase();
- switch(anchor){
- case 't':
- case 'top':
- this.setHeight(1);
- this.setHeight(newSize, true, duration || .5, null, easing || YAHOO.util.Easing.easeOut);
- break;
- case 'l':
- case 'left':
- this.setWidth(1);
- this.setWidth(newSize, true, duration || .5, null, easing || YAHOO.util.Easing.easeOut);
- break;
- }
- this.unclip();
- return size;
-};
-
-/**
-* Hide the element using a "blinds" effect
-* @param {String} anchor The part of the element that it should appear to collapse to.
- The short/long options are t/top, l/left, b/bottom, r/right.
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-* @param {Function} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn)
-*/
-YAHOO.ext.Actor.prototype.blindHide = function(anchor, duration, easing){
- var size = this.getSize();
- this.clip();
- anchor = anchor.toLowerCase();
- switch(anchor){
- case 't':
- case 'top':
- this.setSize(size.width, 1, true, duration || .5, null, easing || YAHOO.util.Easing.easeIn);
- this.setVisible(false);
- break;
- case 'l':
- case 'left':
- this.setSize(1, size.height, true, duration || .5, null, easing || YAHOO.util.Easing.easeIn);
- this.setVisible(false);
- break;
- case 'r':
- case 'right':
- this.animate({width: {to: 1}, points: {by: [this.getWidth(), 0]}},
- duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion);
- this.setVisible(false);
- break;
- case 'b':
- case 'bottom':
- this.animate({height: {to: 1}, points: {by: [0, this.getHeight()]}},
- duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion);
- this.setVisible(false);
- break;
- }
- return size;
-};
-
-/**
-* Show the element using a "slide in" effect - In order for this effect to work the element MUST have a child element container that can be "slid" otherwise a blindShow effect is rendered.
-* @param {String} anchor The part of the element that it should appear to slide from.
- The short/long options currently are t/top, l/left
-* @param {Number} newSize (optional) The size to animate to. (Default to current size)
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-* @param {Function} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOuth)
-*/
-YAHOO.ext.Actor.prototype.slideShow = function(anchor, newSize, duration, easing){
- var size = newSize || this.getSize();
- this.clip();
- var firstChild = this.dom.firstChild;
- if(!firstChild || (firstChild.nodeName && "#TEXT" == firstChild.nodeName.toUpperCase())) { // can't do a slide with only a textnode
- this.blindShow(anchor, newSize, duration, easing);
- return;
- }
- var child = YAHOO.ext.Element.get(firstChild, true);
- var pos = child.getPositioning();
- this.addCall(child.setAbsolutePositioned, null, child);
- this.setVisible(true);
- anchor = anchor.toLowerCase();
- switch(anchor){
- case 't':
- case 'top':
- this.addCall(child.setStyle, ['left', '0px'], child);
- this.addCall(child.setStyle, ['bottom', '0px'], child);
- this.setHeight(1);
- this.setHeight(newSize, true, duration || .5, null, easing || YAHOO.util.Easing.easeOut);
- break;
- case 'l':
- case 'left':
- this.addCall(child.setStyle, ['right', '0px'], child);
- this.addCall(child.setStyle, ['top', '0px'], child);
- this.setWidth(1);
- this.setWidth(newSize, true, duration || .5, null, easing || YAHOO.util.Easing.easeOut);
- break;
- }
- this.addCall(child.setPositioning, [pos], child);
- this.unclip();
- return size;
-};
-
-/**
-* Hide the element using a "slide in" effect - In order for this effect to work the element MUST have a child element container that can be "slid" otherwise a blindHide effect is rendered.
-* @param {String} anchor The part of the element that it should appear to slide to.
- The short/long options are t/top, l/left, b/bottom, r/right.
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-* @param {Function} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn)
-*/
-YAHOO.ext.Actor.prototype.slideHide = function(anchor, duration, easing){
- var size = this.getSize();
- this.clip();
- var firstChild = this.dom.firstChild;
- if(!firstChild || (firstChild.nodeName && "#TEXT" == firstChild.nodeName.toUpperCase())) { // can't do a slide with only a textnode
- this.blindHide(anchor, duration, easing);
- return;
- }
- var child = YAHOO.ext.Element.get(firstChild, true);
- var pos = child.getPositioning();
- this.addCall(child.setAbsolutePositioned, null, child);
- anchor = anchor.toLowerCase();
- switch(anchor){
- case 't':
- case 'top':
- this.addCall(child.setStyle, ['left', '0px'], child);
- this.addCall(child.setStyle, ['bottom', '0px'], child);
- this.setSize(size.width, 1, true, duration || .5, null, easing || YAHOO.util.Easing.easeIn);
- this.setVisible(false);
- break;
- case 'l':
- case 'left':
- this.addCall(child.setStyle, ['right', '0px'], child);
- this.addCall(child.setStyle, ['top', '0px'], child);
- this.setSize(1, size.height, true, duration || .5, null, easing || YAHOO.util.Easing.easeIn);
- this.setVisible(false);
- break;
- case 'r':
- case 'right':
- this.addCall(child.setStyle, ['left', '0px'], child);
- this.addCall(child.setStyle, ['top', '0px'], child);
- this.animate({width: {to: 1}, points: {by: [this.getWidth(), 0]}},
- duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion);
- this.setVisible(false);
- break;
- case 'b':
- case 'bottom':
- this.addCall(child.setStyle, ['left', '0px'], child);
- this.addCall(child.setStyle, ['bottom', '0px'], child);
- this.animate({height: {to: 1}, points: {by: [0, this.getHeight()]}},
- duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion);
- this.setVisible(false);
- break;
- }
- this.addCall(child.setPositioning, [pos], child);
- return size;
-};
-
-/**
-* Hide the element by "squishing" it into the corner
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-*/
-YAHOO.ext.Actor.prototype.squish = function(duration){
- var size = this.getSize();
- this.clip();
- this.setSize(1, 1, true, duration || .5);
- this.setVisible(false);
- return size;
-};
-
-/**
-* Fade an element in
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-*/
-YAHOO.ext.Actor.prototype.appear = function(duration){
- this.setVisible(true, true, duration);
-};
-
-/**
-* Fade an element out
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-*/
-YAHOO.ext.Actor.prototype.fade = function(duration){
- this.setVisible(false, true, duration);
-};
-
-/**
-* Blink the element as if it was clicked and then collapse on it's center
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-*/
-YAHOO.ext.Actor.prototype.switchOff = function(duration){
- this.clip();
- this.setVisible(false, true, .1);
- this.clearOpacity();
- this.setVisible(true);
- this.animate({height: {to: 1}, points: {by: [0, this.getHeight()/2]}},
- duration || .5, null, YAHOO.util.Easing.easeOut, YAHOO.util.Motion);
- this.setVisible(false);
-};
-
-/**
-* Highlight the element using a background color (or passed attribute) animation
-* @param {String} color (optional) The color to use for the highlight
-* @param {String} fromColor (optional) If the element does not currently have a background color, you will need to pass in a color to animate from
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-* @param {String} attribute (optional) Specify a CSS attribute to use other than background color - camelCase
-*/
-YAHOO.ext.Actor.prototype.highlight = function(color, fromColor, duration, attribute){
- attribute = attribute || 'backgroundColor';
- var original = this.getStyle(attribute);
- fromColor = fromColor || ((original && original != '' && original != 'transparent') ? original : '#FFFFFF');
- var cfg = {};
- cfg[attribute] = {to: color, from: fromColor};
- this.setVisible(true);
- this.animate(cfg, duration || .5, null, YAHOO.util.Easing.bounceOut, YAHOO.util.ColorAnim);
- this.setStyle(attribute, original);
-};
-
-/**
-* Fade the element in and out the specified amount of times
-* @param {Number} count (optional) How many times to pulse (Defaults to 3)
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-*/
-YAHOO.ext.Actor.prototype.pulsate = function(count, duration){
- count = count || 3;
- for(var i = 0; i < count; i++){
- this.toggle(true, duration || .25);
- this.toggle(true, duration || .25);
- }
-};
-
-/**
-* Fade the element as it is falling from it's current position
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-*/
-YAHOO.ext.Actor.prototype.dropOut = function(duration){
- this.animate({opacity: {to: 0}, points: {by: [0, this.getHeight()]}},
- duration || .5, null, YAHOO.util.Easing.easeIn, YAHOO.util.Motion);
- this.setVisible(false);
-};
-
-/**
-* Hide the element in a way that it appears as if it is flying off the screen
-* @param {String} anchor The part of the page that the element should appear to move to.
- The short/long options are t/top, l/left, b/bottom, r/right, tl/top-left,
- tr/top-right, bl/bottom-left or br/bottom-right.
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-* @param {Function} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeIn)
-*/
-YAHOO.ext.Actor.prototype.moveOut = function(anchor, duration, easing){
- var Y = YAHOO.util;
- var vw = Y.Dom.getViewportWidth();
- var vh = Y.Dom.getViewportHeight();
- var cpoints = this.getCenterXY()
- var centerX = cpoints[0];
- var centerY = cpoints[1];
- var anchor = anchor.toLowerCase();
- var p;
- switch(anchor){
- case 't':
- case 'top':
- p = [centerX, -this.getHeight()];
- break;
- case 'l':
- case 'left':
- p = [-this.getWidth(), centerY];
- break;
- case 'r':
- case 'right':
- p = [vw+this.getWidth(), centerY];
- break;
- case 'b':
- case 'bottom':
- p = [centerX, vh+this.getHeight()];
- break;
- case 'tl':
- case 'top-left':
- p = [-this.getWidth(), -this.getHeight()];
- break;
- case 'bl':
- case 'bottom':
- p = [-this.getWidth(), vh+this.getHeight()];
- break;
- case 'br':
- case 'bottom-right':
- p = [vw+this.getWidth(), vh+this.getHeight()];
- break;
- case 'tr':
- case 'top-right':
- p = [vw+this.getWidth(), -this.getHeight()];
- break;
- }
- this.moveTo(p[0], p[1], true, duration || .35, null, easing || Y.Easing.easeIn);
- this.setVisible(false);
-};
-
-/**
-* Show the element in a way that it appears as if it is flying onto the screen
-* @param {String} anchor The part of the page that the element should appear to move from.
- The short/long options are t/top, l/left, b/bottom, r/right, tl/top-left,
- tr/top-right, bl/bottom-left or br/bottom-right.
-* @param {Array} to (optional) Array of x and y position to move to like [x, y] (Defaults to center screen)
-* @param {Float} duration (optional) How long the effect lasts (in seconds)
-* @param {Function} easing (optional) YAHOO.util.Easing method to use. (Defaults to YAHOO.util.Easing.easeOut)
-*/
-YAHOO.ext.Actor.prototype.moveIn = function(anchor, to, duration, easing){
- to = to || this.getCenterXY();
- this.moveOut(anchor, .01);
- this.setVisible(true);
- this.setXY(to, true, duration || .35, null, easing || YAHOO.util.Easing.easeOut);
-};
-
-
-
-/**
- * @class Used by {@link YAHOO.ext.Actor} to queue standard calls. Generally used internally. Documentation to come.
-var animator = new YAHOO.ext.Animator();
-var cursor = new YAHOO.ext.Actor('cursor-img', animator);
-var click = new YAHOO.ext.Actor('click-img', animator);
-var resize = new YAHOO.ext.Actor('resize-img', animator);
-
-// start capturing
-animator.startCapture();
-
-// these animations will be run in sequence
-cursor.show();
-cursor.moveTo(500,400);
-cursor.moveTo(20, getEl('navbar').getY()+10, true, .75);
-click.show();
-click.alignTo(cursor, 'tl', [-4, -4]);
-
-// Add an async function call, pass callback to argument 1
-animator.addAsyncCall(Blog.navbar.undockDelegate, 1);
-
-// pause .5 seconds
-animator.pause(.5);
-
-// again, these animations will be run in sequence
-click.hide(true, .7);
-cursor.alignTo('splitter', 'tr', [0, +100], true, 1);
-resize.alignTo('splitter', 'tr', [-12, +100]);
-
-// start sync block: these animations will run at the same time
-animator.beginSync();
-cursor.hide();
-resize.show();
-animator.endSync();
-
-// play the captured animation sequences, call myCallback when done
-animator.play(myCallback);
- *
- * @extends YAHOO.ext.Element
- * @requires YAHOO.ext.Element
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @requires YAHOO.util.Anim
- * @requires YAHOO.util.ColorAnim
- * @requires YAHOO.util.Motion
- * @constructor
- * @param {String/HTMLElement} el The dom element or element id
- * @param {YAHOO.ext.Animator} animator (optional) The Animator that will capture this Actor's actions
- * @param {Boolean} selfCapture (optional) Whether this actor should capture it's own actions to support self playback without an animator (defaults to false)
- */
- YAHOO.ext.Animator = function(/*Actors...*/){
- /** @private */
- this.actors = [];
- /** @private */
- this.playlist = new YAHOO.ext.Animator.AnimSequence();
- /** @private */
- this.captureDelegate = this.capture.createDelegate(this);
- /** @private */
- this.playDelegate = this.play.createDelegate(this);
- /** @private */
- this.syncing = false;
- /** @private */
- this.stopping = false;
- /** @private */
- this.playing = false;
- for(var i = 0; i < arguments.length; i++){
- this.addActor(arguments[i]);
- }
- };
-
- YAHOO.ext.Animator.prototype = {
-
- /**
- * @private
- */
- capture : function(actor, action){
- if(this.syncing){
- if(!this.syncMap[actor.id]){
- this.syncMap[actor.id] = new YAHOO.ext.Animator.AnimSequence();
- }
- this.syncMap[actor.id].add(action);
- }else{
- this.playlist.add(action);
- }
- },
-
- /**
- * Add an actor. The actor is also set to capturing = true.
- * @param {YAHOO.ext.Actor} actor
- */
- addActor : function(actor){
- actor.onCapture.subscribe(this.captureDelegate);
- this.actors.push(actor);
- },
-
-
- /**
- * Start capturing actions on the added actors.
- * @param {Boolean} clearPlaylist Whether to also create a new playlist
- */
- startCapture : function(clearPlaylist){
- for(var i = 0; i < this.actors.length; i++){
- var a = this.actors[i];
- if(!this.isCapturing(a)){
- a.onCapture.subscribe(this.captureDelegate);
- }
- a.capturing = true;
- }
- if(clearPlaylist){
- this.playlist = new YAHOO.ext.Animator.AnimSequence();
- }
- },
-
- /**
- * Checks whether this animator is listening to a specific actor.
- * @param {YAHOO.ext.Actor} actor
- */
- isCapturing : function(actor){
- var subscribers = actor.onCapture.subscribers;
- if(subscribers){
- for(var i = 0; i < subscribers.length; i++){
- if(subscribers[i] && subscribers[i].contains(this.captureDelegate)){
- return true;
- }
- }
- }
- return false;
- },
-
- /**
- * Stop capturing on all added actors.
- */
- stopCapture : function(){
- for(var i = 0; i < this.actors.length; i++){
- var a = this.actors[i];
- a.onCapture.unsubscribe(this.captureDelegate);
- a.capturing = false;
- }
- },
-
- /**
- * Start a multi-actor sync block. By default all animations are run in sequence. While in the sync block
- * each actor's own animations will still be sequenced, but all actors will animate at the same time.
- */
- beginSync : function(){
- this.syncing = true;
- this.syncMap = {};
- },
-
- /**
- * End the multi-actor sync block
- */
- endSync : function(){
- this.syncing = false;
- var composite = new YAHOO.ext.Animator.CompositeSequence();
- for(key in this.syncMap){
- if(typeof this.syncMap[key] != 'function'){
- composite.add(this.syncMap[key]);
- }
- }
- this.playlist.add(composite);
- this.syncMap = null;
- },
-
- /**
- * Starts playback of the playlist, also stops any capturing. To start capturing again call {@link #startCapture}.
- * @param {Function} oncomplete (optional) Callback to execute when playback has completed
- */
- play : function(oncomplete){
- if(this.playing) return; // can't play the same animation twice at once
- this.stopCapture();
- this.playlist.play(oncomplete);
- },
-
- /**
- * Stop at the next available stopping point
- */
- stop : function(){
- this.playlist.stop();
- },
-
- /**
- * Check if this animator is currently playing
- */
- isPlaying : function(){
- return this.playlist.isPlaying();
- },
- /**
- * Clear the playlist
- */
- clear : function(){
- this.playlist = new YAHOO.ext.Animator.AnimSequence();
- },
-
- /**
- * Add a function call to the playlist.
- * @param {Function} fcn The function to call
- * @param {Array} args The arguments to call the function with
- * @param {Object} scope (optional) The scope of the function
- */
- addCall : function(fcn, args, scope){
- this.playlist.add(new YAHOO.ext.Actor.Action(scope, fcn, args || []));
- },
-
- /**
- * Add an async function call to the playlist.
- * @param {Function} fcn The function to call
- * @param {Number} callbackIndex The index of the callback parameter on the passed function. A CALLBACK IS REQUIRED.
- * @param {Array} args The arguments to call the function with
- * @param {Object} scope (optional) The scope of the function
- */
- addAsyncCall : function(fcn, callbackIndex, args, scope){
- this.playlist.add(new YAHOO.ext.Actor.AsyncAction(scope, fcn, args || [], callbackIndex));
- },
-
- /**
- * Add a pause to the playlist (in seconds)
- * @param {Number} seconds The number of seconds to pause.
- */
- pause : function(seconds){
- this.playlist.add(new YAHOO.ext.Actor.PauseAction(seconds));
- }
-
- };
-
-
-/**
- * @class Used by {@link YAHOO.ext.Animator} to sequence animations. Generally used internally. Documentation to come.
- * var myData = [
- ["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
- ["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"]
- * ];
- * var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData);
- *
- * @extends YAHOO.ext.grid.AbstractDataModel
- * @constructor
-*/
-YAHOO.ext.grid.DefaultDataModel = function(data){
- YAHOO.ext.grid.DefaultDataModel.superclass.constructor.call(this);
- /**@private*/
- this.data = data;
-};
-YAHOO.extendX(YAHOO.ext.grid.DefaultDataModel, YAHOO.ext.grid.AbstractDataModel);
-
-/**
- * Returns the number of rows in the dataset
- * @return {Number}
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.getRowCount = function(){
- return this.data.length;
-};
-
-/**
- * Returns the ID of the specified row. By default it return the value of the first column.
- * Override to provide more advanced ID handling.
- * @return {Number}
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.getRowId = function(rowIndex){
- return this.data[rowIndex][0];
-};
-
-/**
- * Returns the column data for the specified row.
- * @return {Array}
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.getRow = function(rowIndex){
- return this.data[rowIndex];
-};
-
-/**
- * Returns the column data for the specified rows as a
- * multi-dimensional array: rows[3][0] would give you the value of row 4, column 0.
- * @param {Array} indexes The row indexes to fetch
- * @return {Array}
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.getRows = function(indexes){
- var data = this.data;
- var r = [];
- for(var i = 0; i < indexes.length; i++){
- r.push(data[indexes[i]]);
- }
- return r;
-};
-
-/**
- * Returns the value at the specified data position
- * @param {Number} rowIndex
- * @param {Number} colIndex
- * @return {Object}
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.getValueAt = function(rowIndex, colIndex){
- return this.data[rowIndex][colIndex];
-};
-
-/**
- * Sets the specified value at the specified data position
- * @param {Object} value The new value
- * @param {Number} rowIndex
- * @param {Number} colIndex
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.setValueAt = function(value, rowIndex, colIndex){
- this.data[rowIndex][colIndex] = value;
- this.fireCellUpdated(rowIndex, colIndex);
-};
-
-/**
- * @private
- * Removes the specified range of rows.
- * @param {Number} startIndex
- * @param {Number} endIndex (optional) Defaults to startIndex
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.removeRows = function(startIndex, endIndex){
- endIndex = endIndex || startIndex;
- this.data.splice(startIndex, endIndex-startIndex+1);
- this.fireRowsDeleted(startIndex, endIndex);
-};
-
-/**
- * Remove a row.
- * @param {Number} index
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.removeRow = function(index){
- this.data.splice(index, 1);
- this.fireRowsDeleted(index, index);
-};
-
-/**
- * @private
- * Removes all rows.
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.removeAll = function(){
- var count = this.getRowCount();
- if(count > 0){
- this.removeRows(0, count-1);
- }
-};
-
-/**
- * Query the DataModel rows by the filters defined in spec, for example...
- *
- * // column 1 starts with Jack, column 2 filtered by myFcn, column 3 equals 'Fred'
- * dataModel.filter({1: /^Jack.+/i}, 2: myFcn, 3: 'Fred'});
- *
- * @param {Object} spec The spec is generally an object literal consisting of
- * column index and filter type. The filter type can be a string/number (exact match),
- * a regular expression to test using String.search() or a function to call. If it's a function,
- * it will be called with the value for the specified column and an array of the all column
- * values for that row: yourFcn(value, columnData). If it returns anything other than true,
- * the row is not a match.
- * @param {Boolean} returnUnmatched True to return rows which don't match the query instead
- * of rows that do match
- * @return {Array} An array of row indexes that match
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.query = function(spec, returnUnmatched){
- var d = this.data;
- var r = [];
- for(var i = 0; i < d.length; i++){
- var row = d[i];
- var isMatch = true;
- for(var col in spec){
- if(typeof spec[col] != 'function'){
- if(!isMatch) continue;
- var filter = spec[col];
- switch(typeof filter){
- case 'string':
- case 'number':
- case 'boolean':
- if(row[col] != filter){
- isMatch = false;
- }
- break;
- case 'function':
- if(!filter(row[col], row)){
- isMatch = false;
- }
- break;
- case 'object':
- if(filter instanceof RegExp){
- if(String(row[col]).search(filter) === -1){
- isMatch = false;
- }
- }
- break;
- }
- }
- }
- if(isMatch && !returnUnmatched){
- r.push(i);
- }else if(!isMatch && returnUnmatched){
- r.push(i);
- }
- }
- return r;
-};
-
-/**
- * Filter the DataModel rows by the query defined in spec, see {@link #query} for more details
- * on the query spec.
- * @param {Object} query The query spec {@link #query}
- * @return {Number} The number of rows removed
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.filter = function(query){
- var matches = this.query(query, true);
- var data = this.data;
- // go thru the data setting matches to deleted
- // while not disturbing row indexes
- for(var i = 0; i < matches.length; i++){
- data[matches[i]]._deleted = true;
- }
- for(var i = 0; i < data.length; i++){
- while(data[i] && data[i]._deleted === true){
- this.removeRow(i);
- }
- }
- return matches.length;
-};
-
-/**
- * Adds a row to the dataset.
- * @param {Array} cellValues The array of values for the new row
- * @return {Number} The index of the added row
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.addRow = function(cellValues){
- this.data.push(cellValues);
- var newIndex = this.data.length-1;
- this.fireRowsInserted(newIndex, newIndex);
- this.applySort();
- return newIndex;
-};
-
-/**
- * @private
- * Adds a set of rows.
- * @param {Array} rowData This should be an array of arrays like the constructor takes
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.addRows = function(rowData){
- this.data = this.data.concat(rowData);
- var firstIndex = this.data.length-rowData.length;
- this.fireRowsInserted(firstIndex, firstIndex+rowData.length-1);
- this.applySort();
-};
-
-/**
- * Inserts a row a the specified location in the dataset.
- * @param {Number} index The index where the row should be inserted
- * @param {Array} cellValues The array of values for the new row
- * @return {Number} The index the row was inserted in
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.insertRow = function(index, cellValues){
- this.data.splice(index, 0, cellValues);
- this.fireRowsInserted(index, index);
- this.applySort();
- return index;
-};
-
-/**
- * @private
- * Inserts a set of rows.
- * @param {Number} index The index where the rows should be inserted
- * @param {Array} rowData This should be an array of arrays like the constructor takes
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.insertRows = function(index, rowData){
- /*
- if(index == this.data.length){ // try these two first since they are faster
- this.data = this.data.concat(rowData);
- }else if(index == 0){
- this.data = rowData.concat(this.data);
- }else{
- var newData = this.data.slice(0, index);
- newData.concat(rowData);
- newData.concat(this.data.slice(index));
- this.data = newData;
- }*/
- var args = rowData.concat();
- args.splice(0, 0, index, 0);
- this.data.splice.apply(this.data, args);
- this.fireRowsInserted(index, index+rowData.length-1);
- this.applySort();
-};
-
-/**
- * Applies the last used sort to the current data.
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.applySort = function(suppressEvent){
- if(this.columnModel && typeof this.sortColumn != 'undefined'){
- this.sort(this.columnModel, this.sortColumn, this.sortDir, suppressEvent);
- }
-};
-
-YAHOO.ext.grid.DefaultDataModel.prototype.setDefaultSort = function(columnModel, columnIndex, direction){
- this.columnModel = columnModel;
- this.sortColumn = columnIndex;
- this.sortDir = direction;
-};
-/**
- * Sorts the data by the specified column - Uses the sortType specified for the column in the passed columnModel.
- * @param {YAHOO.ext.grid.DefaultColumnModel} columnModel The ColumnModel for this dataset
- * @param {Number} columnIndex The column index to sort by
- * @param {String} direction The direction of the sort ('DESC' or 'ASC')
- */
-YAHOO.ext.grid.DefaultDataModel.prototype.sort = function(columnModel, columnIndex, direction, suppressEvent){
- // store these so we can maintain sorting when we load new data
- this.columnModel = columnModel;
- this.sortColumn = columnIndex;
- this.sortDir = direction;
-
- var dsc = direction == 'DESC';
- var sortType = columnModel.getSortType(columnIndex);
- var fn = function(cells, cells2){
- var v1 = sortType(cells[columnIndex], cells);
- var v2 = sortType(cells2[columnIndex], cells2);
- if(v1 < v2)
- return dsc ? -1 : +1;
- if(v1 > v2)
- return dsc ? +1 : -1;
- return 0;
- };
- this.data.sort(fn);
- if(!suppressEvent){
- this.fireRowsSorted(columnIndex, direction);
- }
-};
\ No newline at end of file
diff --git a/www/extras/yui-ext/source/data/JSONDataModel.js b/www/extras/yui-ext/source/data/JSONDataModel.js
deleted file mode 100644
index 8196915a5..000000000
--- a/www/extras/yui-ext/source/data/JSONDataModel.js
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-
-/**
- * @class
- * This is an implementation of a DataModel used by the Grid. It works
- * with JSON data.
- *
- * var schema = {
- * root: 'Results.Result',
- * id: 'ASIN',
- * fields: ['Author', 'Title', 'Manufacturer', 'ProductGroup']
- * };
- *
- * @extends YAHOO.ext.grid.LoadableDataModel
- * @constructor
-*/
-YAHOO.ext.grid.JSONDataModel = function(schema){
- YAHOO.ext.grid.JSONDataModel.superclass.constructor.call(this, YAHOO.ext.grid.LoadableDataModel.JSON);
- /**@private*/
- this.schema = schema;
-};
-YAHOO.extendX(YAHOO.ext.grid.JSONDataModel, YAHOO.ext.grid.LoadableDataModel);
-
-/**
- * Overrides loadData in LoadableDataModel to process JSON data
- * @param {Object} data The JSON object to load
- * @param {Function} callback
- */
-YAHOO.ext.grid.JSONDataModel.prototype.loadData = function(data, callback, keepExisting){
- var idField = this.schema.id;
- var fields = this.schema.fields;
- var rowData = [];
- try{
- var root = eval('data.' + this.schema.root);
- for(var i = 0; i < root.length; i++){
- var node = root[i];
- var colData = [];
- colData.node = node;
- colData.id = (typeof node[idField] != 'undefined' && node[idField] !== '' ? node[idField] : String(i));
- for(var j = 0; j < fields.length; j++) {
- var val = node[fields[j]];
- if(typeof val == 'undefined'){
- val = '';
- }
- if(this.preprocessors[j]){
- val = this.preprocessors[j](val);
- }
- colData.push(val);
- }
- rowData.push(colData);
- }
- if(keepExisting !== true){
- this.removeAll();
- }
- this.addRows(rowData);
- if(typeof callback == 'function'){
- callback(this, true);
- }
- this.fireLoadEvent();
- }catch(e){
- this.fireLoadException(e, null);
- if(typeof callback == 'function'){
- callback(this, false);
- }
- }
-};
-
-/**
- * Overrides getRowId in DefaultDataModel to return the ID value of the specified node.
- * @param {Number} rowIndex
- * @return {Number}
- */
-YAHOO.ext.grid.JSONDataModel.prototype.getRowId = function(rowIndex){
- return this.data[rowIndex].id;
-};
\ No newline at end of file
diff --git a/www/extras/yui-ext/source/data/LoadableDataModel.js b/www/extras/yui-ext/source/data/LoadableDataModel.js
deleted file mode 100644
index 21057a5a4..000000000
--- a/www/extras/yui-ext/source/data/LoadableDataModel.js
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-/**
- * @class
- * This class extends DefaultDataModel and adds the core functionality to load data remotely.
- * var schema = {
- * tagName: 'Item',
- * id: 'ASIN',
- * fields: ['Author', 'Title', 'Manufacturer', 'ProductGroup']
- * };
- *
- * @extends YAHOO.ext.grid.LoadableDataModel
- * @constructor
- * @param {Object} schema The schema to use
- * @param {XMLDocument} xml An XML document to load immediately
-*/
-YAHOO.ext.grid.XMLDataModel = function(schema, xml){
- YAHOO.ext.grid.XMLDataModel.superclass.constructor.call(this, YAHOO.ext.grid.LoadableDataModel.XML);
- /**@private*/
- this.schema = schema;
- this.xml = xml;
- if(xml){
- this.loadData(xml);
- }
-};
-YAHOO.extendX(YAHOO.ext.grid.XMLDataModel, YAHOO.ext.grid.LoadableDataModel);
-
-YAHOO.ext.grid.XMLDataModel.prototype.getDocument = function(){
- return this.xml;
-};
-
-/**
- * Overrides loadData in LoadableDataModel to process XML
- * @param {XMLDocument} doc The document to load
- * @param {Function} callback (optional) callback to call when loading is complete
- * @param {Boolean} keepExisting (optional) true to keep existing data
- * @param {Number} insertIndex (optional) if present, loaded data is inserted at the specified index instead of overwriting existing data
- */
-YAHOO.ext.grid.XMLDataModel.prototype.loadData = function(doc, callback, keepExisting, insertIndex){
- this.xml = doc;
- var idField = this.schema.id;
- var fields = this.schema.fields;
- if(this.schema.totalTag){
- this.totalCount = null;
- var totalNode = doc.getElementsByTagName(this.schema.totalTag);
- if(totalNode && totalNode.item(0) && totalNode.item(0).firstChild) {
- var v = parseInt(totalNode.item(0).firstChild.nodeValue, 10);
- if(!isNaN(v)){
- this.totalCount = v;
- }
- }
- }
- var rowData = [];
- var nodes = doc.getElementsByTagName(this.schema.tagName);
- if(nodes && nodes.length > 0) {
- for(var i = 0; i < nodes.length; i++) {
- var node = nodes.item(i);
- var colData = [];
- colData.node = node;
- colData.id = this.getNamedValue(node, idField, String(i));
- for(var j = 0; j < fields.length; j++) {
- var val = this.getNamedValue(node, fields[j], "");
- if(this.preprocessors[j]){
- val = this.preprocessors[j](val);
- }
- colData.push(val);
- }
- rowData.push(colData);
- }
- }
- if(keepExisting !== true){
- YAHOO.ext.grid.XMLDataModel.superclass.removeAll.call(this);
- }
- if(typeof insertIndex != 'number'){
- insertIndex = this.getRowCount();
- }
- YAHOO.ext.grid.XMLDataModel.superclass.insertRows.call(this, insertIndex, rowData);
- if(typeof callback == 'function'){
- callback(this, true);
- }
- this.fireLoadEvent();
-};
-
-/**
- * Adds a row to this DataModel and syncs the XML document
- * @param {String} id The id of the row, if null the next row index is used
- * @param {Array} cellValues The cell values for this row
- * @return {Number} The index of the new row
- */
-YAHOO.ext.grid.XMLDataModel.prototype.addRow = function(id, cellValues){
- var newIndex = this.getRowCount();
- var node = this.createNode(this.xml, id, cellValues);
- cellValues.id = id || newIndex;
- cellValues.node = node;
- YAHOO.ext.grid.XMLDataModel.superclass.addRow.call(this, cellValues);
- return newIndex;
-};
-
-/**
- * Inserts a row into this DataModel and syncs the XML document
- * @param {Number} index The index to insert the row
- * @param {String} id The id of the row, if null the next row index is used
- * @param {Array} cellValues The cell values for this row
- * @return {Number} The index of the new row
- */
-YAHOO.ext.grid.XMLDataModel.prototype.insertRow = function(index, id, cellValues){
- var node = this.createNode(this.xml, id, cellValues);
- cellValues.id = id || this.getRowCount();
- cellValues.node = node;
- YAHOO.ext.grid.XMLDataModel.superclass.insertRow.call(this, index, cellValues);
- return index;
-};
-
-/**
- * Removes the row from DataModel and syncs the XML document
- * @param {Number} index The index of the row to remove
- */
-YAHOO.ext.grid.XMLDataModel.prototype.removeRow = function(index){
- var node = this.data[index].node;
- node.parentNode.removeChild(node);
- YAHOO.ext.grid.XMLDataModel.superclass.removeRow.call(this, index, index);
-};
-
-YAHOO.ext.grid.XMLDataModel.prototype.getNode = function(rowIndex){
- return this.data[rowIndex].node;
-};
-
-/**
- * Override this method to define your own node creation routine for when new rows are added.
- * By default this method clones the first node and sets the column values in the newly cloned node.
- * @param {XMLDocument} xmlDoc The xml document being used by this model
- * @param {Array} colData The column data for the new node
- * @return {XMLNode} The created node
- */
-YAHOO.ext.grid.XMLDataModel.prototype.createNode = function(xmlDoc, id, colData){
- var template = this.data[0].node;
- var newNode = template.cloneNode(true);
- var fields = this.schema.fields;
- for(var i = 0; i < fields.length; i++){
- var nodeValue = colData[i];
- if(this.postprocessors[i]){
- nodeValue = this.postprocessors[i](nodeValue);
- }
- this.setNamedValue(newNode, fields[i], nodeValue);
- }
- if(id){
- this.setNamedValue(newNode, this.schema.idField, id);
- }
- template.parentNode.appendChild(newNode);
- return newNode;
-};
-
-/**
- * Convenience function looks for value in attributes, then in children tags - also
- * normalizes namespace matches (ie matches ns:tag, FireFox matches tag and not ns:tag).
- */
-YAHOO.ext.grid.XMLDataModel.prototype.getNamedValue = function(node, name, defaultValue){
- if(!node || !name){
- return defaultValue;
- }
- var nodeValue = defaultValue;
- var attrNode = node.attributes.getNamedItem(name);
- if(attrNode) {
- nodeValue = attrNode.value;
- } else {
- var childNode = node.getElementsByTagName(name);
- if(childNode && childNode.item(0) && childNode.item(0).firstChild) {
- nodeValue = childNode.item(0).firstChild.nodeValue;
- }else{
- // try to strip namespace for FireFox
- var index = name.indexOf(':');
- if(index > 0){
- return this.getNamedValue(node, name.substr(index+1), defaultValue);
- }
- }
- }
- return nodeValue;
-};
-
-/**
- * Convenience function set a value in the underlying xml node.
- */
-YAHOO.ext.grid.XMLDataModel.prototype.setNamedValue = function(node, name, value){
- if(!node || !name){
- return;
- }
- var attrNode = node.attributes.getNamedItem(name);
- if(attrNode) {
- attrNode.value = value;
- return;
- }
- var childNode = node.getElementsByTagName(name);
- if(childNode && childNode.item(0) && childNode.item(0).firstChild) {
- childNode.item(0).firstChild.nodeValue = value;
- }else{
- // try to strip namespace for FireFox
- var index = name.indexOf(':');
- if(index > 0){
- this.setNamedValue(node, name.substr(index+1), value);
- }
- }
-};
-
-/**
- * Overrides DefaultDataModel.setValueAt to update the underlying XML Document
- * @param {Object} value The new value
- * @param {Number} rowIndex
- * @param {Number} colIndex
- */
-YAHOO.ext.grid.XMLDataModel.prototype.setValueAt = function(value, rowIndex, colIndex){
- var node = this.data[rowIndex].node;
- if(node){
- var nodeValue = value;
- if(this.postprocessors[colIndex]){
- nodeValue = this.postprocessors[colIndex](value);
- }
- this.setNamedValue(node, this.schema.fields[colIndex], nodeValue);
- }
- YAHOO.ext.grid.XMLDataModel.superclass.setValueAt.call(this, value, rowIndex, colIndex);
-};
-
-/**
- * Overrides getRowId in DefaultDataModel to return the ID value of the specified node.
- * @param {Number} rowIndex
- * @return {Number}
- */
-YAHOO.ext.grid.XMLDataModel.prototype.getRowId = function(rowIndex){
- return this.data[rowIndex].id;
-};
\ No newline at end of file
diff --git a/www/extras/yui-ext/source/grid/AbstractColumnModel.js b/www/extras/yui-ext/source/grid/AbstractColumnModel.js
deleted file mode 100644
index 7b269e171..000000000
--- a/www/extras/yui-ext/source/grid/AbstractColumnModel.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-/**
- * @class
- * This abstract class defines the ColumnModel interface and provides default implementations of the events required by the Grid.
- * @constructor
-*/
-YAHOO.ext.grid.AbstractColumnModel = function(){
- /** Fires when a column width is changed - fireDirect sig: (this, columnIndex, newWidth)
- * @type YAHOO.util.CustomEvent
- * */
- this.onWidthChange = new YAHOO.util.CustomEvent('widthChanged');
- /** Fires when a header has changed - fireDirect sig: (this, columnIndex, newHeader)
- * @type YAHOO.util.CustomEvent
- * */
- this.onHeaderChange = new YAHOO.util.CustomEvent('headerChanged');
- /** Fires when a column is hidden or unhidden - fireDirect sig: (this, columnIndex, hidden)
- * @type YAHOO.util.CustomEvent
- * */
- this.onHiddenChange = new YAHOO.util.CustomEvent('hiddenChanged');
-};
-
-YAHOO.ext.grid.AbstractColumnModel.prototype = {
- fireWidthChange : function(colIndex, newWidth){
- this.onWidthChange.fireDirect(this, colIndex, newWidth);
- },
-
- fireHeaderChange : function(colIndex, newHeader){
- this.onHeaderChange.fireDirect(this, colIndex, newHeader);
- },
-
- fireHiddenChange : function(colIndex, hidden){
- this.onHiddenChange.fireDirect(this, colIndex, hidden);
- },
-
- /**
- * Interface method - Returns the number of columns.
- * @return {Number}
- */
- getColumnCount : function(){
- return 0;
- },
-
- /**
- * Interface method - Returns true if the specified column is sortable.
- * @param {Number} col The column index
- * @return {Boolean}
- */
- isSortable : function(col){
- return false;
- },
-
- /**
- * Interface method - Returns true if the specified column is hidden.
- * @param {Number} col The column index
- * @return {Boolean}
- */
- isHidden : function(col){
- return false;
- },
-
- /**
- * Interface method - Returns the sorting comparison function defined for the column (defaults to sortTypes.none).
- * @param {Number} col The column index
- * @return {Function}
- */
- getSortType : function(col){
- return YAHOO.ext.grid.DefaultColumnModel.sortTypes.none;
- },
-
- /**
- * Interface method - Returns the rendering (formatting) function defined for the column.
- * @param {Number} col The column index
- * @return {Function}
- */
- getRenderer : function(col){
- return YAHOO.ext.grid.DefaultColumnModel.defaultRenderer;
- },
-
- /**
- * Interface method - Returns the width for the specified column.
- * @param {Number} col The column index
- * @return {Number}
- */
- getColumnWidth : function(col){
- return 0;
- },
-
- /**
- * Interface method - Returns the total width of all columns.
- * @return {Number}
- */
- getTotalWidth : function(){
- return 0;
- },
-
- /**
- * Interface method - Returns the header for the specified column.
- * @param {Number} col The column index
- * @return {String}
- */
- getColumnHeader : function(col){
- return '';
- }
-};
diff --git a/www/extras/yui-ext/source/grid/DefaultColumnModel.js b/www/extras/yui-ext/source/grid/DefaultColumnModel.js
deleted file mode 100644
index 7a0ff62f6..000000000
--- a/www/extras/yui-ext/source/grid/DefaultColumnModel.js
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-
-/**
- * @class
- * This is the default implementation of a ColumnModel used by the Grid. It defines
- * the columns in the grid.
- *
- * var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
- * var myColumns = [
- {header: "Ticker", width: 60, sortable: true, sortType: sort.asUCString},
- {header: "Company Name", width: 150, sortable: true, sortType: sort.asUCString},
- {header: "Market Cap.", width: 100, sortable: true, sortType: sort.asFloat},
- {header: "$ Sales", width: 100, sortable: true, sortType: sort.asFloat, renderer: money},
- {header: "Employees", width: 100, sortable: true, sortType: sort.asFloat}
- * ];
- * var colModel = new YAHOO.ext.grid.DefaultColumnModel(myColumns);
- *
- * @extends YAHOO.ext.grid.AbstractColumnModel
- * @constructor
-*/
-YAHOO.ext.grid.DefaultColumnModel = function(config){
- YAHOO.ext.grid.DefaultColumnModel.superclass.constructor.call(this);
- /**
- * The config passed into the constructor
- */
- this.config = config;
-
- /**
- * The width of columns which have no width specified (defaults to 100)
- * @type Number
- */
- this.defaultWidth = 100;
- /**
- * Default sortable of columns which have no sortable specified (defaults to false)
- * @type Boolean
- */
- this.defaultSortable = false;
-};
-YAHOO.extendX(YAHOO.ext.grid.DefaultColumnModel, YAHOO.ext.grid.AbstractColumnModel);
-
-/**
- * Returns the number of columns.
- * @return {Number}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.getColumnCount = function(){
- return this.config.length;
-};
-
-/**
- * Returns true if the specified column is sortable.
- * @param {Number} col The column index
- * @return {Boolean}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.isSortable = function(col){
- if(typeof this.config[col].sortable == 'undefined'){
- return this.defaultSortable;
- }
- return this.config[col].sortable;
-};
-
-/**
- * Returns the sorting comparison function defined for the column (defaults to sortTypes.none).
- * @param {Number} col The column index
- * @return {Function}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.getSortType = function(col){
- if(!this.dataMap){
- // build a lookup so we don't search every time
- var map = [];
- for(var i = 0, len = this.config.length; i < len; i++){
- map[this.getDataIndex(i)] = i;
- }
- this.dataMap = map;
- }
- col = this.dataMap[col];
- if(!this.config[col].sortType){
- return YAHOO.ext.grid.DefaultColumnModel.sortTypes.none;
- }
- return this.config[col].sortType;
-};
-
-/**
- * Sets the sorting comparison function for a column.
- * @param {Number} col The column index
- * @param {Function} fn
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.setSortType = function(col, fn){
- this.config[col].sortType = fn;
-};
-
-
-/**
- * Returns the rendering (formatting) function defined for the column.
- * @param {Number} col The column index
- * @return {Function}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.getRenderer = function(col){
- if(!this.config[col].renderer){
- return YAHOO.ext.grid.DefaultColumnModel.defaultRenderer;
- }
- return this.config[col].renderer;
-};
-
-/**
- * Sets the rendering (formatting) function for a column.
- * @param {Number} col The column index
- * @param {Function} fn
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.setRenderer = function(col, fn){
- this.config[col].renderer = fn;
-};
-
-/**
- * Returns the width for the specified column.
- * @param {Number} col The column index
- * @return {Number}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.getColumnWidth = function(col){
- return this.config[col].width || this.defaultWidth;
-};
-
-/**
- * Sets the width for a column.
- * @param {Number} col The column index
- * @param {Number} width The new width
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.setColumnWidth = function(col, width, suppressEvent){
- this.config[col].width = width;
- this.totalWidth = null;
- if(!suppressEvent){
- this.onWidthChange.fireDirect(this, col, width);
- }
-};
-
-/**
- * Returns the total width of all columns.
- * @param {Boolean} includeHidden True to include hidden column widths
- * @return {Number}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.getTotalWidth = function(includeHidden){
- if(!this.totalWidth){
- this.totalWidth = 0;
- for(var i = 0; i < this.config.length; i++){
- if(includeHidden || !this.isHidden(i)){
- this.totalWidth += this.getColumnWidth(i);
- }
- }
- }
- return this.totalWidth;
-};
-
-/**
- * Returns the header for the specified column.
- * @param {Number} col The column index
- * @return {String}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.getColumnHeader = function(col){
- return this.config[col].header;
-};
-
-/**
- * Sets the header for a column.
- * @param {Number} col The column index
- * @param {String} header The new header
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.setColumnHeader = function(col, header){
- this.config[col].header = header;
- this.onHeaderChange.fireDirect(this, col, header);
-};
-/**
- * Returns the dataIndex for the specified column.
- * @param {Number} col The column index
- * @return {Number}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.getDataIndex = function(col){
- if(typeof this.config[col].dataIndex != 'number'){
- return col;
- }
- return this.config[col].dataIndex;
-};
-
-/**
- * Sets the dataIndex for a column.
- * @param {Number} col The column index
- * @param {Number} dataIndex The new dataIndex
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.setDataIndex = function(col, dataIndex){
- this.config[col].dataIndex = dataIndex;
-};
-/**
- * Returns true if the cell is editable.
- * @param {Number} colIndex The column index
- * @param {Number} rowIndex The row index
- * @return {Boolean}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.isCellEditable = function(colIndex, rowIndex){
- return this.config[colIndex].editable || (typeof this.config[colIndex].editable == 'undefined' && this.config[colIndex].editor);
-};
-
-/**
- * Returns the editor defined for the cell/column.
- * @param {Number} colIndex The column index
- * @param {Number} rowIndex The row index
- * @return {Object}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.getCellEditor = function(colIndex, rowIndex){
- return this.config[colIndex].editor;
-};
-
-/**
- * Sets if a column is editable.
- * @param {Number} col The column index
- * @param {Boolean} editable True if the column is editable
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.setEditable = function(col, editable){
- this.config[col].editable = editable;
-};
-
-
-/**
- * Returns true if the column is hidden.
- * @param {Number} colIndex The column index
- * @return {Boolean}
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.isHidden = function(colIndex){
- return this.config[colIndex].hidden;
-};
-
-/**
- * Sets if a column is hidden.
- * @param {Number} colIndex The column index
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.setHidden = function(colIndex, hidden){
- this.config[colIndex].hidden = hidden;
- this.totalWidth = null;
- this.fireHiddenChange(colIndex, hidden);
-};
-
-/**
- * Sets the editor for a column.
- * @param {Number} col The column index
- * @param {Object} editor The editor object
- */
-YAHOO.ext.grid.DefaultColumnModel.prototype.setEditor = function(col, editor){
- this.config[col].editor = editor;
-};
-
-
-/**
- * Default empty rendering function
- */
-YAHOO.ext.grid.DefaultColumnModel.defaultRenderer = function(value){
- if(typeof value == 'string' && value.length < 1){
- return ' ';
- }
- return value;
-}
-
-/**
- * Defines the default sorting (casting?) comparison functions used when sorting data:
- *
- * var grid = new YAHOO.ext.grid.Grid('my-container-id', dataModel, columnModel);
- * // set any options
- * grid.render();
- *
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @requires YAHOO.ext.Element
- * @requires YAHOO.ext.util.Browser
- * @requires YAHOO.ext.util.CSS
- * @requires YAHOO.ext.SplitBar
- * @requires YAHOO.ext.EventObject
- * @constructor
- * @param {String/HTMLElement/YAHOO.ext.Element} container The element into which this grid will be rendered -
- * The container MUST have some type of size defined for the grid to fill. The container will be
- * automatically set to position relative if it isn't already.
- * @param {Object} dataModel The data model to bind to
- * @param {Object} colModel The column model with info about this grid's columns
- * @param {Object} selectionModel (optional) The selection model for this grid (defaults to DefaultSelectionModel)
- */
-YAHOO.ext.grid.Grid = function(container, dataModel, colModel, selectionModel){
- /** @private */
- this.container = YAHOO.ext.Element.get(container);
- if(this.container.getStyle('position') != 'absolute'){
- this.container.setStyle('position', 'relative');
- }
- //this.container.setStyle('overflow', 'hidden');
- /** @private */
- this.id = this.container.id;
-
- /** @private */
- this.rows = [];
- /** @private */
- this.rowCount = 0;
- /** @private */
- this.fieldId = null;
- /** @private */
- this.dataModel = dataModel;
- /** @private */
- this.colModel = colModel;
- /** @private */
- this.selModel = selectionModel;
-
- /** @private */
- this.activeEditor = null;
-
- /** @private */
- this.editingCell = null;
-
- /** The minimum width a column can be resized to. (Defaults to 25)
- * @type Number */
- this.minColumnWidth = 25;
-
- /** True to automatically resize the columns to fit their content on initial render
- * @type Boolean */
- this.autoSizeColumns = false;
-
- /** True to measure headers with column data when auto sizing columns
- * @type Boolean */
- this.autoSizeHeaders = false;
-
- /**
- * True to autoSize the grid when the window resizes - defaults to true
- */
- this.monitorWindowResize = true;
-
- /** If autoSizeColumns is on, maxRowsToMeasure can be used to limit the number of
- * rows measured to get a columns size - defaults to 0 (all rows).
- * @type Number */
- this.maxRowsToMeasure = 0;
-
- /** True to highlight rows when the mouse is over (default is false)
- * @type Boolean */
- this.trackMouseOver = false;
-
- /** True to enable drag and drop of rows
- * @type Boolean */
- this.enableDragDrop = false;
-
- /** True to stripe the rows (default is true)
- * @type Boolean */
- this.stripeRows = true;
-
- /** A regular expression defining tagNames
- * allowed to have text selection (Defaults to /INPUT|TEXTAREA/i) */
- this.allowTextSelectionPattern = /INPUT|TEXTAREA|SELECT/i;
-
- /** @private */
- this.setValueDelegate = this.setCellValue.createDelegate(this);
-
- var CE = YAHOO.util.CustomEvent;
- /** @private */
- this.events = {
- // raw events
- 'click' : new CE('click'),
- 'dblclick' : new CE('dblclick'),
- 'mousedown' : new CE('mousedown'),
- 'mouseup' : new CE('mouseup'),
- 'mouseover' : new CE('mouseover'),
- 'mouseout' : new CE('mouseout'),
- 'keypress' : new CE('keypress'),
- 'keydown' : new CE('keydown'),
- // custom events
- 'cellclick' : new CE('cellclick'),
- 'celldblclick' : new CE('celldblclick'),
- 'rowclick' : new CE('rowclick'),
- 'rowdblclick' : new CE('rowdblclick'),
- 'headerclick' : new CE('headerclick'),
- 'rowcontextmenu' : new CE('rowcontextmenu'),
- 'headercontextmenu' : new CE('headercontextmenu'),
- 'beforeedit' : new CE('beforeedit'),
- 'afteredit' : new CE('afteredit'),
- 'bodyscroll' : new CE('bodyscroll'),
- 'columnresize' : new CE('columnresize'),
- 'startdrag' : new CE('startdrag'),
- 'enddrag' : new CE('enddrag'),
- 'dragdrop' : new CE('dragdrop'),
- 'dragover' : new CE('dragover'),
- 'dragenter' : new CE('dragenter'),
- 'dragout' : new CE('dragout')
- };
-};
-
-YAHOO.ext.grid.Grid.prototype = {
- /**
- * Called once after all setup has been completed and the grid is ready to be rendered.
- */
- render : function(){
- if(!this.view){
- if(this.dataModel.isPaged()){
- this.view = new YAHOO.ext.grid.PagedGridView();
- }else{
- this.view = new YAHOO.ext.grid.GridView();
- }
- }
- this.view.init(this);
- this.el = getEl(this.view.render(), true);
- var c = this.container;
- c.mon("click", this.onClick, this, true);
- c.mon("dblclick", this.onDblClick, this, true);
- c.mon("contextmenu", this.onContextMenu, this, true);
- c.mon("selectstart", this.cancelTextSelection, this, true);
- c.mon("mousedown", this.cancelTextSelection, this, true);
- c.mon("mousedown", this.onMouseDown, this, true);
- c.mon("mouseup", this.onMouseUp, this, true);
- if(this.trackMouseOver){
- this.el.mon("mouseover", this.onMouseOver, this, true);
- this.el.mon("mouseout", this.onMouseOut, this, true);
- }
- c.mon("keypress", this.onKeyPress, this, true);
- c.mon("keydown", this.onKeyDown, this, true);
- this.init();
- },
-
- /** @private */
- init : function(){
- this.rows = this.el.dom.rows;
- if(!this.disableSelection){
- if(!this.selModel){
- this.selModel = new YAHOO.ext.grid.DefaultSelectionModel(this);
- }
- this.selModel.init(this);
- this.selModel.onSelectionChange.subscribe(this.updateField, this, true);
- }else{
- this.selModel = new YAHOO.ext.grid.DisableSelectionModel(this);
- this.selModel.init(this);
- }
-
- if(this.enableDragDrop){
- this.dd = new YAHOO.ext.grid.GridDD(this, this.container.dom);
- }
- },
-
- /** @ignore */
- onMouseDown : function(e){
- this.fireEvent('mousedown', e);
- },
-
- /** @ignore */
- onMouseUp : function(e){
- this.fireEvent('mouseup', e);
- },
-
- /** @ignore */
- onMouseOver : function(e){
- this.fireEvent('mouseover', e);
- },
-
- /** @ignore */
- onMouseOut : function(e){
- this.fireEvent('mouseout', e);
- },
-
- /** @ignore */
- onKeyPress : function(e){
- this.fireEvent('keypress', e);
- },
-
- /** @ignore */
- onKeyDown : function(e){
- this.fireEvent('keydown', e);
- },
-
- /**
- * @private internal event firing
- * expects arguments[0] is the event name and the rest are the fireDirect arguments
- */
- fireEvent : function(){
- var ce = this.events[arguments[0].toLowerCase()];
- ce.fireDirect.apply(ce, Array.prototype.slice.call(arguments, 1));
- },
- /**
- * Adds a listener for one of the many defined grid events
- * @param {String} eventName The type of event to listen for
- * @param {Function} fn The method the event invokes
- * @param {Object} scope (optional) An arbitrary object that will be
- * passed as a parameter to the handler
- * @param {boolean} override (optional) If true, the obj passed in becomes
- * the execution scope of the listener
- */
- addListener : function(eventName, fn, scope, override){
- this.events[eventName.toLowerCase()].subscribe(fn, scope, override);
- },
-
- /**
- * Shorthand for addListener
- */
- on : function(eventName, fn, scope, override){
- this.events[eventName.toLowerCase()].subscribe(fn, scope, override);
- },
-
- removeListener : function(eventName, fn, scope){
- this.events[eventName.toLowerCase()].unsubscribe(fn, scope);
- },
-
- /** @ignore */
- onClick : function(e){
- this.fireEvent('click', e);
- var target = e.getTarget();
- var row = this.getRowFromChild(target);
- var cell = this.getCellFromChild(target);
- var header = this.getHeaderFromChild(target);
- if(row){
- this.fireEvent('rowclick', this, row.rowIndex, e);
- }
- if(cell){
- this.fireEvent('cellclick', this, row.rowIndex, cell.columnIndex, e);
- }
- if(header){
- this.fireEvent('headerclick', this, header.columnIndex, e);
- }
- },
-
- /** @ignore */
- onContextMenu : function(e){
- var target = e.getTarget();
- var row = this.getRowFromChild(target);
- var header = this.getHeaderFromChild(target);
- if(row){
- this.fireEvent('rowcontextmenu', this, row.rowIndex, e);
- }
- if(header){
- this.fireEvent('headercontextmenu', this, header.columnIndex, e);
- }
- e.preventDefault();
- },
-
- /** @ignore */
- onDblClick : function(e){
- this.fireEvent('dblclick', e);
- var target = e.getTarget();
- var row = this.getRowFromChild(target);
- var cell = this.getCellFromChild(target);
- if(row){
- this.fireEvent('rowdblclick', this, row.rowIndex, e);
- }
- if(cell){
- this.fireEvent('celldblclick', this, row.rowIndex, cell.columnIndex, e);
- }
- },
-
- /**
- * Starts editing the specified for the specified row/column
- */
- startEditing : function(rowIndex, colIndex){
- var row = this.rows[rowIndex];
- var cell = row.childNodes[colIndex];
- this.stopEditing();
- setTimeout(this.doEdit.createDelegate(this, [row, cell]), 10);
- },
-
- /**
- * Stops any active editing
- */
- stopEditing : function(){
- if(this.activeEditor){
- this.activeEditor.stopEditing();
- }
- },
-
- /** @ignore */
- doEdit : function(row, cell){
- if(!row || !cell) return;
- var cm = this.colModel;
- var dm = this.dataModel;
- var colIndex = cell.columnIndex;
- var rowIndex = row.rowIndex;
- if(cm.isCellEditable(colIndex, rowIndex)){
- var ed = cm.getCellEditor(colIndex, rowIndex);
- if(ed){
- if(this.activeEditor){
- this.activeEditor.stopEditing();
- }
- this.fireEvent('beforeedit', this, rowIndex, colIndex);
- this.activeEditor = ed;
- this.editingCell = cell;
- this.view.ensureVisible(row, true);
- try{
- cell.focus();
- }catch(e){}
- ed.init(this, this.el.dom.parentNode, this.setValueDelegate);
- var value = dm.getValueAt(rowIndex, cm.getDataIndex(colIndex));
- // set timeout so firefox stops editing before starting a new edit
- setTimeout(ed.startEditing.createDelegate(ed, [value, row, cell]), 1);
- }
- }
- },
-
- setCellValue : function(value, rowIndex, colIndex){
- this.dataModel.setValueAt(value, rowIndex, this.colModel.getDataIndex(colIndex));
- this.fireEvent('afteredit', this, rowIndex, colIndex);
- },
-
- /** @ignore Called when text selection starts or mousedown to prevent default */
- cancelTextSelection : function(e){
- var target = e.getTarget();
- if(target && target != this.el.dom.parentNode && !this.allowTextSelectionPattern.test(target.tagName)){
- e.preventDefault();
- }
- },
-
- /**
- * Causes the grid to manually recalculate it's dimensions. Generally this is done automatically,
- * but if manual update is required this method will initiate it.
- */
- autoSize : function(){
- this.view.updateWrapHeight();
- this.view.adjustForScroll();
- },
-
- /**
- * Scrolls the grid to the specified row
- * @param {Number/HTMLElement} row The row object or index of the row
- */
- scrollTo : function(row){
- if(typeof row == 'number'){
- row = this.rows[row];
- }
- this.view.ensureVisible(row, true);
- },
-
- /** @private */
- getEditingCell : function(){
- return this.editingCell;
- },
-
- /**
- * Binds this grid to the field with the specified id. Initially reads and parses the comma
- * delimited ids in the field and selects those items. All selections made in the grid
- * will be persisted to the field by their ids comma delimited.
- * @param {String} The id of the field to bind to
- */
- bindToField : function(fieldId){
- this.fieldId = fieldId;
- this.readField();
- },
-
- /** @private */
- updateField : function(){
- if(this.fieldId){
- var field = YAHOO.util.Dom.get(this.fieldId);
- field.value = this.getSelectedRowIds().join(',');
- }
- },
-
- /**
- * Causes the grid to read and select the ids from the bound field - See {@link #bindToField}.
- */
- readField : function(){
- if(this.fieldId){
- var field = YAHOO.util.Dom.get(this.fieldId);
- var values = field.value.split(',');
- var rows = this.getRowsById(values);
- this.selModel.selectRows(rows, false);
- }
- },
-
- /**
- * Returns the table row at the specified index
- * @return {HTMLElement}
- */
- getRow : function(index){
- return this.rows[index];
- },
-
- /**
- * Returns the rows that have the specified id(s). The id value for a row is provided
- * by the DataModel. See {@link YAHOO.ext.grid.DefaultDataModel#getRowId}.
- * @param {String/Array} An id to find or an array of ids
- * @return {HtmlElement/Array} If one id was passed in, it returns one result.
- * If an array of ids was specified, it returns an Array of HTMLElements
- */
- getRowsById : function(id){
- var dm = this.dataModel;
- if(!(id instanceof Array)){
- for(var i = 0; i < this.rows.length; i++){
- if(dm.getRowId(i) == id){
- return this.rows[i];
- }
- }
- return null;
- }
- var found = [];
- var re = "^(?:";
- for(var i = 0; i < id.length; i++){
- re += id[i];
- if(i != id.length-1) re += "|";
- }
- var regex = new RegExp(re + ")$");
- for(var i = 0; i < this.rows.length; i++){
- if(regex.test(dm.getRowId(i))){
- found.push(this.rows[i]);
- }
- }
- return found;
- },
-
- /**
- * Returns the row that comes after the specified row - text nodes are skipped.
- * @param {HTMLElement} row
- * @return {HTMLElement}
- */
- getRowAfter : function(row){
- return this.getSibling('next', row);
- },
-
- /**
- * Returns the row that comes before the specified row - text nodes are skipped.
- * @param {HTMLElement} row
- * @return {HTMLElement}
- */
- getRowBefore : function(row){
- return this.getSibling('previous', row);
- },
-
- /**
- * Returns the cell that comes after the specified cell - text nodes are skipped.
- * @param {HTMLElement} cell
- * @param {Boolean} includeHidden
- * @return {HTMLElement}
- */
- getCellAfter : function(cell, includeHidden){
- var next = this.getSibling('next', cell);
- if(next && !includeHidden && this.colModel.isHidden(next.columnIndex)){
- return this.getCellAfter(next);
- }
- return next;
- },
-
- /**
- * Returns the cell that comes before the specified cell - text nodes are skipped.
- * @param {HTMLElement} cell
- * @param {Boolean} includeHidden
- * @return {HTMLElement}
- */
- getCellBefore : function(cell, includeHidden){
- var prev = this.getSibling('previous', cell);
- if(prev && !includeHidden && this.colModel.isHidden(prev.columnIndex)){
- return this.getCellBefore(prev);
- }
- return prev;
- },
-
- /**
- * Returns the last cell for the row - text nodes and hidden columns are skipped.
- * @param {HTMLElement} row
- * @param {Boolean} includeHidden
- * @return {HTMLElement}
- */
- getLastCell : function(row, includeHidden){
- var cell = this.getElement('previous', row.lastChild);
- if(cell && !includeHidden && this.colModel.isHidden(cell.columnIndex)){
- return this.getCellBefore(cell);
- }
- return cell;
- },
-
- /**
- * Returns the first cell for the row - text nodes and hidden columns are skipped.
- * @param {HTMLElement} row
- * @param {Boolean} includeHidden
- * @return {HTMLElement}
- */
- getFirstCell : function(row, includeHidden){
- var cell = this.getElement('next', row.firstChild);
- if(cell && !includeHidden && this.colModel.isHidden(cell.columnIndex)){
- return this.getCellAfter(cell);
- }
- return cell;
- },
-
- /**
- * Gets siblings, skipping text nodes
- * @param {String} type The direction to walk: 'next' or 'previous'
- * @private
- */
- getSibling : function(type, node){
- if(!node) return null;
- type += 'Sibling';
- var n = node[type];
- while(n && n.nodeType != 1){
- n = n[type];
- }
- return n;
- },
-
- /**
- * Returns node if node is an HTMLElement else walks the siblings in direction looking for
- * a node that is an element
- * @param {String} direction The direction to walk: 'next' or 'previous'
- * @private
- */
- getElement : function(direction, node){
- if(!node || node.nodeType == 1) return node;
- else return this.getSibling(direction, node);
- },
-
- /**
- * @private
- */
- getElementFromChild : function(childEl, parentClass){
- if(!childEl || (YAHOO.util.Dom.hasClass(childEl, parentClass))){
- return childEl;
- }
- var p = childEl.parentNode;
- while(p && p.tagName.toUpperCase() != 'BODY'){
- if(YAHOO.util.Dom.hasClass(p, parentClass)){
- return p;
- }
- p = p.parentNode;
- }
- return null;
- },
-
- /**
- * Returns the row that contains the specified child element.
- * @param {HTMLElement} childEl
- * @return {HTMLElement}
- */
- getRowFromChild : function(childEl){
- return this.getElementFromChild(childEl, 'ygrid-row');
- },
-
- /**
- * Returns the cell that contains the specified child element.
- * @param {HTMLElement} childEl
- * @return {HTMLElement}
- */
- getCellFromChild : function(childEl){
- return this.getElementFromChild(childEl, 'ygrid-col');
- },
-
-
- /**
- * Returns the header element that contains the specified child element.
- * @param {HTMLElement} childEl
- * @return {HTMLElement}
- */
- getHeaderFromChild : function(childEl){
- return this.getElementFromChild(childEl, 'ygrid-hd');
- },
-
- /**
- * Convenience method for getSelectionModel().getSelectedRows() -
- * See {@link YAHOO.ext.grid.DefaultSelectionModel#getSelectedRows} for more details.
- */
- getSelectedRows : function(){
- return this.selModel.getSelectedRows();
- },
-
- /**
- * Convenience method for getSelectionModel().getSelectedRows()[0] -
- * See {@link YAHOO.ext.grid.DefaultSelectionModel#getSelectedRows} for more details.
- */
- getSelectedRow : function(){
- if(this.selModel.hasSelection()){
- return this.selModel.getSelectedRows()[0];
- }
- return null;
- },
-
- /**
- * Get the selected row indexes
- * @return {Array} Array of indexes
- */
- getSelectedRowIndexes : function(){
- var a = [];
- var rows = this.selModel.getSelectedRows();
- for(var i = 0; i < rows.length; i++) {
- a[i] = rows[i].rowIndex;
- }
- return a;
- },
-
- /**
- * Gets the first selected row or -1 if none are selected
- * @return {Number}
- */
- getSelectedRowIndex : function(){
- if(this.selModel.hasSelection()){
- return this.selModel.getSelectedRows()[0].rowIndex;
- }
- return -1;
- },
-
- /**
- * Convenience method for getSelectionModel().getSelectedRowIds()[0] -
- * See {@link YAHOO.ext.grid.DefaultSelectionModel#getSelectedRowIds} for more details.
- */
- getSelectedRowId : function(){
- if(this.selModel.hasSelection()){
- return this.selModel.getSelectedRowIds()[0];
- }
- return null;
- },
-
- /**
- * Convenience method for getSelectionModel().getSelectedRowIds() -
- * See {@link YAHOO.ext.grid.DefaultSelectionModel#getSelectedRowIds} for more details.
- */
- getSelectedRowIds : function(){
- return this.selModel.getSelectedRowIds();
- },
-
- /**
- * Convenience method for getSelectionModel().clearSelections() -
- * See {@link YAHOO.ext.grid.DefaultSelectionModel#clearSelections} for more details.
- */
- clearSelections : function(){
- this.selModel.clearSelections();
- },
-
-
- /**
- * Convenience method for getSelectionModel().selectAll() -
- * See {@link YAHOO.ext.grid.DefaultSelectionModel#selectAll} for more details.
- */
- selectAll : function(){
- this.selModel.selectAll();
- },
-
-
- /**
- * Convenience method for getSelectionModel().getCount() -
- * See {@link YAHOO.ext.grid.DefaultSelectionModel#getCount} for more details.
- */
- getSelectionCount : function(){
- return this.selModel.getCount();
- },
-
- /**
- * Convenience method for getSelectionModel().hasSelection() -
- * See {@link YAHOO.ext.grid.DefaultSelectionModel#hasSelection} for more details.
- */
- hasSelection : function(){
- return this.selModel.hasSelection();
- },
-
- /**
- * Returns the grid's SelectionModel.
- */
- getSelectionModel : function(){
- if(!this.selModel){
- this.selModel = new DefaultSelectionModel();
- }
- return this.selModel;
- },
-
- /**
- * Returns the grid's DataModel.
- */
- getDataModel : function(){
- return this.dataModel;
- },
-
- /**
- * Returns the grid's ColumnModel.
- */
- getColumnModel : function(){
- return this.colModel;
- },
-
- /**
- * Returns the grid's GridView object.
- */
- getView : function(){
- return this.view;
- },
- /**
- * Called to get grid's drag proxy text, by default returns this.ddText.
- * @return {String}
- */
- getDragDropText : function(){
- return this.ddText.replace('%0', this.selModel.getCount());
- }
-};
-/**
- * Configures the text is the drag proxy (defaults to "%0 selected row(s)").
- * %0 is replaced with the number of selected rows.
- * @type String
- */
-YAHOO.ext.grid.Grid.prototype.ddText = "%0 selected row(s)";
\ No newline at end of file
diff --git a/www/extras/yui-ext/source/grid/GridDD.js b/www/extras/yui-ext/source/grid/GridDD.js
deleted file mode 100644
index 246cdfaf3..000000000
--- a/www/extras/yui-ext/source/grid/GridDD.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-
-// kill dependency issue
-if(YAHOO.util.DDProxy){
-/**
- * @class
- * Custom implementation of YAHOO.util.DDProxy used internally by the grid
- * @extends YAHOO.util.DDProxy
- */
-YAHOO.ext.grid.GridDD = function(grid, bwrap){
- this.grid = grid;
- var ddproxy = document.createElement('div');
- ddproxy.id = grid.container.id + '-ddproxy';
- ddproxy.className = 'ygrid-drag-proxy';
- document.body.insertBefore(ddproxy, document.body.firstChild);
- YAHOO.util.Dom.setStyle(ddproxy, 'opacity', .80);
- var ddicon = document.createElement('span');
- ddicon.className = 'ygrid-drop-icon ygrid-drop-nodrop';
- ddproxy.appendChild(ddicon);
- var ddtext = document.createElement('span');
- ddtext.className = 'ygrid-drag-text';
- ddtext.innerHTML = " ";
- ddproxy.appendChild(ddtext);
-
- this.ddproxy = ddproxy;
- this.ddtext = ddtext;
- this.ddicon = ddicon;
- YAHOO.util.Event.on(bwrap, 'click', this.handleClick, this, true);
- YAHOO.ext.grid.GridDD.superclass.constructor.call(this, bwrap.id, 'GridDD',
- {dragElId : ddproxy.id, resizeFrame: false});
-
- this.unlockDelegate = grid.selModel.unlock.createDelegate(grid.selModel);
-};
-YAHOO.extendX(YAHOO.ext.grid.GridDD, YAHOO.util.DDProxy);
-
-YAHOO.ext.grid.GridDD.prototype.handleMouseDown = function(e){
- var row = this.grid.getRowFromChild(YAHOO.util.Event.getTarget(e));
- if(!row) return;
- if(this.grid.selModel.isSelected(row)){
- YAHOO.ext.grid.GridDD.superclass.handleMouseDown.call(this, e);
- }else {
- this.grid.selModel.unlock();
- YAHOO.ext.EventObject.setEvent(e);
- this.grid.selModel.rowClick(this.grid, row.rowIndex, YAHOO.ext.EventObject);
- YAHOO.ext.grid.GridDD.superclass.handleMouseDown.call(this, e);
- this.grid.selModel.lock();
- }
-};
-
-YAHOO.ext.grid.GridDD.prototype.handleClick = function(e){
- if(this.grid.selModel.isLocked()){
- setTimeout(this.unlockDelegate, 1);
- YAHOO.util.Event.stopEvent(e);
- }
-};
-
-/**
- * Updates the DD visual element to allow/not allow a drop
- * @param {Boolean} dropStatus True if drop is allowed on the target
- */
-YAHOO.ext.grid.GridDD.prototype.setDropStatus = function(dropStatus){
- if(dropStatus === true){
- YAHOO.util.Dom.replaceClass(this.ddicon, 'ygrid-drop-nodrop', 'ygrid-drop-ok');
- }else{
- YAHOO.util.Dom.replaceClass(this.ddicon, 'ygrid-drop-ok', 'ygrid-drop-nodrop');
- }
-};
-
-YAHOO.ext.grid.GridDD.prototype.startDrag = function(e){
- this.ddtext.innerHTML = this.grid.getDragDropText();
- this.setDropStatus(false);
- this.grid.selModel.lock();
- this.grid.fireEvent('startdrag', this.grid, this, e);
-};
-
-YAHOO.ext.grid.GridDD.prototype.endDrag = function(e){
- YAHOO.util.Dom.setStyle(this.ddproxy, 'visibility', 'hidden');
- this.grid.fireEvent('enddrag', this.grid, this, e);
-};
-
-YAHOO.ext.grid.GridDD.prototype.autoOffset = function(iPageX, iPageY) {
- this.setDelta(-12, -20);
-};
-
-YAHOO.ext.grid.GridDD.prototype.onDragEnter = function(e, id) {
- this.setDropStatus(true);
- this.grid.fireEvent('dragenter', this.grid, this, id, e);
-};
-
-YAHOO.ext.grid.GridDD.prototype.onDragDrop = function(e, id) {
- this.grid.fireEvent('dragdrop', this.grid, this, id, e);
-};
-
-YAHOO.ext.grid.GridDD.prototype.onDragOver = function(e, id) {
- this.grid.fireEvent('dragover', this.grid, this, id, e);
-};
-
-YAHOO.ext.grid.GridDD.prototype.onDragOut = function(e, id) {
- this.setDropStatus(false);
- this.grid.fireEvent('dragout', this.grid, this, id, e);
-};
-};
\ No newline at end of file
diff --git a/www/extras/yui-ext/source/grid/GridView.js b/www/extras/yui-ext/source/grid/GridView.js
deleted file mode 100644
index 869f56b6f..000000000
--- a/www/extras/yui-ext/source/grid/GridView.js
+++ /dev/null
@@ -1,791 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-/**
- * @class
- * Default UI code used internally by the Grid. Documentation to come.
- * @constructor
- */
-YAHOO.ext.grid.GridView = function(){
- /** @private */
- this.grid = null;
-
- /** @private */
- this.lastFocusedRow = null;
- /**
- * Fires when the ViewPort is scrolled - fireDirect sig: (this, scrollLeft, scrollTop)
- * @type YAHOO.util.CustomEvent
- * @deprecated
- */
- this.onScroll = new YAHOO.util.CustomEvent('onscroll');
-
- /**
- * @private
- */
- this.adjustScrollTask = new YAHOO.ext.util.DelayedTask(this._adjustForScroll, this);
- /**
- * @private
- */
- this.ensureVisibleTask = new YAHOO.ext.util.DelayedTask();
-};
-
-YAHOO.ext.grid.GridView.prototype = {
- init: function(grid){
- this.grid = grid;
- },
-
- fireScroll: function(scrollLeft, scrollTop){
- this.onScroll.fireDirect(this.grid, scrollLeft, scrollTop);
- },
-
- /**
- * Utility method that gets an array of the cell renderers
- */
- getColumnRenderers : function(){
- var renderers = [];
- var cm = this.grid.colModel;
- var colCount = cm.getColumnCount();
- for(var i = 0; i < colCount; i++){
- renderers.push(cm.getRenderer(i));
- }
- return renderers;
- },
-
- buildIndexMap : function(){
- var colToData = {};
- var dataToCol = {};
- var cm = this.grid.colModel;
- for(var i = 0, len = cm.getColumnCount(); i < len; i++){
- var di = cm.getDataIndex(i);
- colToData[i] = di;
- dataToCol[di] = i;
- }
- return {'colToData': colToData, 'dataToCol': dataToCol};
- },
-
- getDataIndexes : function(){
- if(!this.indexMap){
- this.indexMap = this.buildIndexMap();
- }
- return this.indexMap.colToData;
- },
-
- getColumnIndexByDataIndex : function(dataIndex){
- if(!this.indexMap){
- this.indexMap = this.buildIndexMap();
- }
- return this.indexMap.dataToCol[dataIndex];
- },
-
- updateHeaders : function(){
- var colModel = this.grid.colModel;
- var hcells = this.headers;
- var colCount = colModel.getColumnCount();
- for(var i = 0; i < colCount; i++){
- hcells[i].textNode.innerHTML = colModel.getColumnHeader(i);
- }
- },
-
- adjustForScroll : function(disableDelay){
- if(!disableDelay){
- this.adjustScrollTask.delay(50);
- }else{
- this._adjustForScroll();
- }
- },
-
- getCellAtPoint : function(x, y){
- var colIndex = null;
- var rowIndex = null;
-
- // translate page coordinates to local coordinates
- var xy = YAHOO.util.Dom.getXY(this.wrap);
- x = (x - xy[0]) + this.wrap.scrollLeft;
- y = (y - xy[1]) + this.wrap.scrollTop;
-
- var colModel = this.grid.colModel;
- var pos = 0;
- var colCount = colModel.getColumnCount();
- for(var i = 0; i < colCount; i++){
- if(colModel.isHidden(i)) continue;
- var width = colModel.getColumnWidth(i);
- if(x >= pos && x < pos+width){
- colIndex = i;
- break;
- }
- pos += width;
- }
- if(colIndex != null){
- rowIndex = (y == 0 ? 0 : Math.floor(y / this.getRowHeight()));
- if(rowIndex >= this.grid.dataModel.getRowCount()){
- return null;
- }
- return [colIndex, rowIndex];
- }
- return null;
- },
-
- /** @private */
- _adjustForScroll : function(){
- this.forceScrollUpdate();
- if(this.scrollbarMode == YAHOO.ext.grid.GridView.SCROLLBARS_OVERLAP){
- var adjustment = 0;
- if(this.wrap.clientWidth && this.wrap.clientWidth != 0){
- adjustment = this.wrap.offsetWidth - this.wrap.clientWidth;
- }
- this.hwrap.setWidth(this.wrap.offsetWidth-adjustment);
- }else{
- this.hwrap.setWidth(this.wrap.offsetWidth);
- }
- this.bwrap.setWidth(Math.max(this.grid.colModel.getTotalWidth(), this.wrap.clientWidth));
- },
-
- focusRow : function(row){
- if(typeof row == 'number'){
- row = this.getBodyTable().childNodes[row];
- }
- if(!row) return;
- var left = this.wrap.scrollLeft;
- try{ // try catch for IE occasional focus bug
- row.childNodes.item(0).hideFocus = true;
- row.childNodes.item(0).focus();
- }catch(e){}
- this.ensureVisible(row);
- this.wrap.scrollLeft = left;
- this.handleScroll();
- this.lastFocusedRow = row;
- },
-
- ensureVisible : function(row, disableDelay){
- if(!disableDelay){
- this.ensureVisibleTask.delay(50, this._ensureVisible, this, [row]);
- }else{
- this._ensureVisible(row);
- }
- },
-
- /** @ignore */
- _ensureVisible : function(row){
- if(typeof row == 'number'){
- row = this.getBodyTable().childNodes[row];
- }
- if(!row) return;
- var left = this.wrap.scrollLeft;
- var rowTop = parseInt(row.offsetTop, 10); // parseInt for safari bug
- var rowBottom = rowTop + row.offsetHeight;
- var clientTop = parseInt(this.wrap.scrollTop, 10); // parseInt for safari bug
- var clientBottom = clientTop + this.wrap.clientHeight;
- if(rowTop < clientTop){
- this.wrap.scrollTop = rowTop;
- }else if(rowBottom > clientBottom){
- this.wrap.scrollTop = rowBottom-this.wrap.clientHeight;
- }
- this.wrap.scrollLeft = left;
- this.handleScroll();
- },
-
- updateColumns : function(){
- this.grid.stopEditing();
- var colModel = this.grid.colModel;
- var hcols = this.headers;
- var colCount = colModel.getColumnCount();
- var pos = 0;
- var totalWidth = colModel.getTotalWidth();
- for(var i = 0; i < colCount; i++){
- if(colModel.isHidden(i)) continue;
- var width = colModel.getColumnWidth(i);
- hcols[i].style.width = width + 'px';
- hcols[i].style.left = pos + 'px';
- hcols[i].split.style.left = (pos+width-3) + 'px';
- this.setCSSWidth(i, width, pos);
- pos += width;
- }
- this.lastWidth = totalWidth;
- this.bwrap.setWidth(Math.max(totalWidth, this.wrap.clientWidth));
- if(!YAHOO.ext.util.Browser.isIE){ // fix scrolling prob in gecko and opera
- this.wrap.scrollLeft = this.hwrap.dom.scrollLeft;
- }
- this.syncScroll();
- this.forceScrollUpdate();
- },
-
- setCSSWidth : function(colIndex, width, pos){
- var selector = ["#" + this.grid.id + " .ygrid-col-" + colIndex, ".ygrid-col-" + colIndex];
- YAHOO.ext.util.CSS.updateRule(selector, 'width', width + 'px');
- if(typeof pos == 'number'){
- YAHOO.ext.util.CSS.updateRule(selector, 'left', pos + 'px');
- }
- },
-
- handleHiddenChange : function(colModel, colIndex, hidden){
- if(hidden){
- this.hideColumn(colIndex);
- }else{
- this.unhideColumn(colIndex);
- }
- this.updateColumns();
- },
-
- hideColumn : function(colIndex){
- var selector = ["#" + this.grid.id + " .ygrid-col-" + colIndex, ".ygrid-col-" + colIndex];
- YAHOO.ext.util.CSS.updateRule(selector, 'position', 'absolute');
- YAHOO.ext.util.CSS.updateRule(selector, 'visibility', 'hidden');
-
- this.headers[colIndex].style.display = 'none';
- this.headers[colIndex].split.style.display = 'none';
- },
-
- unhideColumn : function(colIndex){
- var selector = ["#" + this.grid.id + " .ygrid-col-" + colIndex, ".ygrid-col-" + colIndex];
- YAHOO.ext.util.CSS.updateRule(selector, 'position', '');
- YAHOO.ext.util.CSS.updateRule(selector, 'visibility', 'visible');
-
- this.headers[colIndex].style.display = '';
- this.headers[colIndex].split.style.display = '';
- },
-
- getBodyTable : function(){
- return this.bwrap.dom;
- },
-
- updateRowIndexes : function(firstRow, lastRow){
- var stripeRows = this.grid.stripeRows;
- var bt = this.getBodyTable();
- var nodes = bt.childNodes;
- firstRow = firstRow || 0;
- lastRow = lastRow || nodes.length-1;
- var re = /^(?:ygrid-row ygrid-row-alt|ygrid-row)/;
- for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
- var node = nodes[rowIndex];
- if(stripeRows && (rowIndex+1) % 2 == 0){
- node.className = node.className.replace(re, 'ygrid-row ygrid-row-alt');
- }else{
- node.className = node.className.replace(re, 'ygrid-row');
- }
- node.rowIndex = rowIndex;
- nodes[rowIndex].style.top = (rowIndex * this.rowHeight) + 'px';
- }
- },
-
- insertRows : function(dataModel, firstRow, lastRow){
- this.updateBodyHeight();
- this.adjustForScroll(true);
- var renderers = this.getColumnRenderers();
- var dindexes = this.getDataIndexes();
- var colCount = this.grid.colModel.getColumnCount();
- var beforeRow = null;
- var bt = this.getBodyTable();
- if(firstRow < bt.childNodes.length){
- beforeRow = bt.childNodes[firstRow];
- }
- for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
- var row = document.createElement('span');
- row.className = 'ygrid-row';
- row.style.top = (rowIndex * this.rowHeight) + 'px';
- this.renderRow(dataModel, row, rowIndex, colCount, renderers, dindexes);
- if(beforeRow){
- bt.insertBefore(row, beforeRow);
- }else{
- bt.appendChild(row);
- }
- }
- this.updateRowIndexes(firstRow);
- this.adjustForScroll();
- },
-
- renderRow : function(dataModel, row, rowIndex, colCount, renderers, dindexes){
- for(var colIndex = 0; colIndex < colCount; colIndex++){
- var td = document.createElement('span');
- td.className = 'ygrid-col ygrid-col-' + colIndex + (colIndex == colCount-1 ? ' ygrid-col-last' : '');
- td.columnIndex = colIndex;
- td.tabIndex = 0;
- var span = document.createElement('span');
- span.className = 'ygrid-cell-text';
- td.appendChild(span);
- var val = renderers[colIndex](dataModel.getValueAt(rowIndex, dindexes[colIndex]), rowIndex, colIndex);
- if(val == '') val = ' ';
- span.innerHTML = val;
- row.appendChild(td);
- }
- },
-
- deleteRows : function(dataModel, firstRow, lastRow){
- this.updateBodyHeight();
- // first make sure they are deselected
- this.grid.selModel.deselectRange(firstRow, lastRow);
- var bt = this.getBodyTable();
- var rows = []; // get references because the rowIndex will change
- for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
- rows.push(bt.childNodes[rowIndex]);
- }
- for(var i = 0; i < rows.length; i++){
- bt.removeChild(rows[i]);
- rows[i] = null;
- }
- rows = null;
- this.updateRowIndexes(firstRow);
- this.adjustForScroll();
- },
-
- updateRows : function(dataModel, firstRow, lastRow){
- var bt = this.getBodyTable();
- var dindexes = this.getDataIndexes();
- var renderers = this.getColumnRenderers();
- var colCount = this.grid.colModel.getColumnCount();
- for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
- var row = bt.rows[rowIndex];
- var cells = row.childNodes;
- for(var colIndex = 0; colIndex < colCount; colIndex++){
- var td = cells[colIndex];
- var val = renderers[colIndex](dataModel.getValueAt(rowIndex, dindexes[colIndex]), rowIndex, colIndex);
- if(val == '') val = ' ';
- td.firstChild.innerHTML = val;
- }
- }
- },
-
- handleSort : function(dataModel, sortColumnIndex, sortDir, noRefresh){
- this.grid.selModel.syncSelectionsToIds();
- if(!noRefresh){
- this.updateRows(dataModel, 0, dataModel.getRowCount()-1);
- }
- this.updateHeaderSortState();
- if(this.lastFocusedRow){
- this.focusRow(this.lastFocusedRow);
- }
- },
-
- syncScroll : function(){
- this.hwrap.dom.scrollLeft = this.wrap.scrollLeft;
- },
-
- handleScroll : function(){
- this.syncScroll();
- this.fireScroll(this.wrap.scrollLeft, this.wrap.scrollTop);
- this.grid.fireEvent('bodyscroll', this.wrap.scrollLeft, this.wrap.scrollTop);
- },
-
- getRowHeight : function(){
- if(!this.rowHeight){
- var rule = YAHOO.ext.util.CSS.getRule(["#" + this.grid.id + " .ygrid-row", ".ygrid-row"]);
- if(rule && rule.style.height){
- this.rowHeight = parseInt(rule.style.height, 10);
- }else{
- this.rowHeight = 21;
- }
- }
- return this.rowHeight;
- },
-
- renderRows : function(dataModel){
- if(this.grid.selModel){
- this.grid.selModel.clearSelections();
- }
- var bt = this.getBodyTable();
- bt.innerHTML = '';
- this.rowHeight = this.getRowHeight();
- this.insertRows(dataModel, 0, dataModel.getRowCount()-1);
- },
-
- updateCell : function(dataModel, rowIndex, dataIndex){
- var colIndex = this.getColumnIndexByDataIndex(dataIndex);
- if(typeof colIndex == 'undefined'){ // not present in grid
- return;
- }
- var bt = this.getBodyTable();
- var row = bt.childNodes[rowIndex];
- var cell = row.childNodes[colIndex];
- var renderer = this.grid.colModel.getRenderer(colIndex);
- var val = renderer(dataModel.getValueAt(rowIndex, dataIndex), rowIndex, colIndex);
- if(val == '') val = ' ';
- cell.firstChild.innerHTML = val;
- },
-
- calcColumnWidth : function(colIndex, maxRowsToMeasure){
- var maxWidth = 0;
- var bt = this.getBodyTable();
- var rows = bt.childNodes;
- var stopIndex = Math.min(maxRowsToMeasure || rows.length, rows.length);
- if(this.grid.autoSizeHeaders){
- var h = this.headers[colIndex];
- var curWidth = h.style.width;
- h.style.width = this.grid.minColumnWidth+'px';
- maxWidth = Math.max(maxWidth, h.scrollWidth);
- h.style.width = curWidth;
- }
- for(var i = 0; i < stopIndex; i++){
- var cell = rows[i].childNodes[colIndex].firstChild;
- maxWidth = Math.max(maxWidth, cell.scrollWidth);
- }
- return maxWidth + /*margin for error in IE*/ 5;
- },
-
- autoSizeColumn : function(colIndex, forceMinSize){
- if(forceMinSize){
- this.setCSSWidth(colIndex, this.grid.minColumnWidth);
- }
- var newWidth = this.calcColumnWidth(colIndex);
- this.grid.colModel.setColumnWidth(colIndex,
- Math.max(this.grid.minColumnWidth, newWidth));
- this.grid.fireEvent('columnresize', colIndex, newWidth);
- },
-
- autoSizeColumns : function(){
- var colModel = this.grid.colModel;
- var colCount = colModel.getColumnCount();
- var wrap = this.wrap;
- for(var i = 0; i < colCount; i++){
- this.setCSSWidth(i, this.grid.minColumnWidth);
- colModel.setColumnWidth(i, this.calcColumnWidth(i, this.grid.maxRowsToMeasure), true);
- }
- if(colModel.getTotalWidth() < wrap.clientWidth){
- var diff = Math.floor((wrap.clientWidth - colModel.getTotalWidth()) / colCount);
- for(var i = 0; i < colCount; i++){
- colModel.setColumnWidth(i, colModel.getColumnWidth(i) + diff, true);
- }
- }
- this.updateColumns();
- },
-
- onWindowResize : function(){
- if(this.grid.monitorWindowResize){
- this.updateWrapHeight();
- this.adjustForScroll();
- }
- },
-
- updateWrapHeight : function(){
- this.grid.container.beginMeasure();
- var box = this.grid.container.getBox(true);
- this.wrapEl.setHeight(box.height-this.footerHeight-parseInt(this.wrap.offsetTop, 10));
- this.grid.container.endMeasure();
- },
-
- forceScrollUpdate : function(){
- var wrap = this.wrap;
- YAHOO.util.Dom.setStyle(wrap, 'width', (wrap.offsetWidth) +'px');
- setTimeout(function(){ // set timeout so FireFox works
- YAHOO.util.Dom.setStyle(wrap, 'width', '');
- }, 1);
- },
-
- updateHeaderSortState : function(){
- var state = this.grid.dataModel.getSortState();
- var sortColumn = this.getColumnIndexByDataIndex(state.column);
- var sortDir = state.direction;
- for(var i = 0, len = this.headers.length; i < len; i++){
- var h = this.headers[i];
- if(i != sortColumn){
- h.sortDesc.style.display = 'none';
- h.sortAsc.style.display = 'none';
- }else{
- h.sortDesc.style.display = sortDir == 'DESC' ? 'block' : 'none';
- h.sortAsc.style.display = sortDir == 'ASC' ? 'block' : 'none';
- }
- }
- },
-
- render : function(){
- var grid = this.grid;
- var container = grid.container.dom;
- var dataModel = grid.dataModel;
- dataModel.onCellUpdated.subscribe(this.updateCell, this, true);
- dataModel.onTableDataChanged.subscribe(this.renderRows, this, true);
- dataModel.onRowsDeleted.subscribe(this.deleteRows, this, true);
- dataModel.onRowsInserted.subscribe(this.insertRows, this, true);
- dataModel.onRowsUpdated.subscribe(this.updateRows, this, true);
- dataModel.onRowsSorted.subscribe(this.handleSort, this, true);
-
- var colModel = grid.colModel;
- colModel.onWidthChange.subscribe(this.updateColumns, this, true);
- colModel.onHeaderChange.subscribe(this.updateHeaders, this, true);
- colModel.onHiddenChange.subscribe(this.handleHiddenChange, this, true);
-
- YAHOO.util.Event.on(window, 'resize', this.onWindowResize, this, true);
-
- var autoSizeDelegate = this.autoSizeColumn.createDelegate(this);
-
- var colCount = colModel.getColumnCount();
-
- var dh = YAHOO.ext.DomHelper;
- //create wrapper elements that handle offsets and scrolling
- var wrap = dh.append(container, {tag: 'div', cls: 'ygrid-wrap'});
- this.wrap = wrap;
- this.wrapEl = getEl(wrap, true);
- YAHOO.ext.EventManager.on(wrap, 'scroll', this.handleScroll, this, true);
-
- var hwrap = dh.append(container, {tag: 'div', cls: 'ygrid-wrap-headers'});
- this.hwrap = getEl(hwrap, true);
-
- var bwrap = dh.append(wrap, {tag: 'div', cls: 'ygrid-wrap-body', id: container.id + '-body'});
- this.bwrap = getEl(bwrap, true);
- this.bwrap.setWidth(colModel.getTotalWidth());
- bwrap.rows = bwrap.childNodes;
-
- this.footerHeight = 0;
- var foot = this.appendFooter(container);
- if(foot){
- this.footer = getEl(foot, true);
- this.footerHeight = this.footer.getHeight();
- }
- this.updateWrapHeight();
-
- var hrow = dh.append(hwrap, {tag: 'span', cls: 'ygrid-hrow'});
- this.hrow = hrow;
-
- // IE doesn't like iframes, we will leave this alone
- var iframe = document.createElement('iframe');
- iframe.className = 'ygrid-hrow-frame';
- iframe.frameBorder = 0;
- hwrap.appendChild(iframe);
-
- this.headerCtrl = new YAHOO.ext.grid.HeaderController(this.grid);
- this.headers = [];
- this.cols = [];
-
-
-
- var htemplate = dh.createTemplate({
- tag: 'span', cls: 'ygrid-hd ygrid-header-{0}', children: [{
- tag: 'span',
- cls: 'ygrid-hd-body',
- html: '| {1} | ' + - '' + - ' |
- * var split = new YAHOO.ext.SplitBar('elementToDrag', 'elementToSize',
- * YAHOO.ext.SplitBar.HORIZONTAL, YAHOO.ext.SplitBar.LEFT);
- * split.setAdapter(new YAHOO.ext.SplitBar.AbsoluteLayoutAdapter("container"));
- * split.minSize = 100;
- * split.maxSize = 600;
- * split.animate = true;
- * split.onMoved.subscribe(splitterMoved);
- *
- * @requires YAHOO.ext.Element
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @requires YAHOO.util.DDProxy
- * @requires YAHOO.util.Anim (optional) to support animation
- * @requires YAHOO.util.Easing (optional) to support animation
- * @constructor
- * @param {String/HTMLElement/Element} dragElement The element to be dragged and act as the SplitBar.
- * @param {String/HTMLElement/Element} resizingElement The element to be resized based on where the SplitBar element is dragged
- * @param {Number} orientation (optional) Either YAHOO.ext.SplitBar.HORIZONTAL or YAHOO.ext.SplitBar.VERTICAL. (Defaults to HORIZONTAL)
- * @param {Number} placement (optional) Either YAHOO.ext.SplitBar.LEFT or YAHOO.ext.SplitBar.RIGHT for horizontal or
- YAHOO.ext.SplitBar.TOP or YAHOO.ext.SplitBar.BOTTOM for vertical. (By default, this is determined automatically by the intial position
- position of the SplitBar).
- */
-YAHOO.ext.SplitBar = function(dragElement, resizingElement, orientation, placement){
-
- /** @private */
- this.el = YAHOO.ext.Element.get(dragElement, true);
-
- /** @private */
- this.resizingEl = YAHOO.ext.Element.get(resizingElement, true);
-
- /**
- * @private
- * The orientation of the split. Either YAHOO.ext.SplitBar.HORIZONTAL or YAHOO.ext.SplitBar.VERTICAL. (Defaults to HORIZONTAL)
- * Note: If this is changed after creating the SplitBar, the placement property must be manually updated
- * @type Number
- */
- this.orientation = orientation || YAHOO.ext.SplitBar.HORIZONTAL;
-
- /**
- * The minimum size of the resizing element. (Defaults to 0)
- * @type Number
- */
- this.minSize = 0;
-
- /**
- * The maximum size of the resizing element. (Defaults to 2000)
- * @type Number
- */
- this.maxSize = 2000;
-
- /**
- * Fires when the SplitBar is moved. Uses fireDirect with signature: (this, newSize)
- * @type CustomEvent
- */
- this.onMoved = new YAHOO.util.CustomEvent("SplitBarMoved", this);
-
- /**
- * Whether to animate the transition to the new size
- * @type Boolean
- */
- this.animate = false;
-
- /**
- * Whether to create a transparent shim that overlays the page when dragging, enables dragging across iframes.
- * @type Boolean
- */
- this.useShim = false;
-
- /** @private */
- this.shim = null;
-
- /** @private */
- this.proxy = YAHOO.ext.SplitBar.createProxy(this.orientation);
-
- /** @private */
- this.dd = new YAHOO.util.DDProxy(this.el.dom.id, "SplitBars", {dragElId : this.proxy.id});
-
- /** @private */
- this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this);
-
- /** @private */
- this.dd.endDrag = this.onEndProxyDrag.createDelegate(this);
-
- /** @private */
- this.dragSpecs = {};
-
- /**
- * @private The adapter to use to positon and resize elements
- */
- this.adapter = new YAHOO.ext.SplitBar.BasicLayoutAdapter();
- this.adapter.init(this);
-
- if(this.orientation == YAHOO.ext.SplitBar.HORIZONTAL){
- /** @private */
- this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? YAHOO.ext.SplitBar.LEFT : YAHOO.ext.SplitBar.RIGHT);
- this.el.setStyle('cursor', 'e-resize');
- }else{
- /** @private */
- this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? YAHOO.ext.SplitBar.TOP : YAHOO.ext.SplitBar.BOTTOM);
- this.el.setStyle('cursor', 'n-resize');
- }
-
- this.events = {
- 'resize' : this.onMoved,
- 'moved' : this.onMoved
- }
-}
-
-YAHOO.ext.SplitBar.prototype = {
- fireEvent : YAHOO.ext.util.Observable.prototype.fireEvent,
- addListener : YAHOO.ext.util.Observable.prototype.addListener,
- delayedListener : YAHOO.ext.util.Observable.prototype.delayedListener,
- removeListener : YAHOO.ext.util.Observable.prototype.removeListener,
- /**
- * @private Called before drag operation begins by the DDProxy
- */
- onStartProxyDrag : function(x, y){
- if(this.useShim){
- if(!this.shim){
- this.shim = YAHOO.ext.SplitBar.createShim();
- }
- this.shim.setVisible(true);
- }
- YAHOO.util.Dom.setStyle(this.proxy, 'display', 'block');
- var size = this.adapter.getElementSize(this);
- var c1 = size - this.minSize;
- var c2 = Math.max(this.maxSize - size, 0);
- if(this.orientation == YAHOO.ext.SplitBar.HORIZONTAL){
- this.dd.resetConstraints();
- this.dd.setXConstraint(
- this.placement == YAHOO.ext.SplitBar.LEFT ? c1 : c2,
- this.placement == YAHOO.ext.SplitBar.LEFT ? c2 : c1
- );
- this.dd.setYConstraint(0, 0);
- }else{
- this.dd.resetConstraints();
- this.dd.setXConstraint(0, 0);
- this.dd.setYConstraint(
- this.placement == YAHOO.ext.SplitBar.TOP ? c1 : c2,
- this.placement == YAHOO.ext.SplitBar.TOP ? c2 : c1
- );
- }
- this.dragSpecs.startSize = size;
- this.dragSpecs.startPoint = [x, y];
-
- YAHOO.util.DDProxy.prototype.b4StartDrag.call(this.dd, x, y);
- },
-
- /**
- * @private Called after the drag operation by the DDProxy
- */
- onEndProxyDrag : function(e){
- YAHOO.util.Dom.setStyle(this.proxy, 'display', 'none');
- var endPoint = YAHOO.util.Event.getXY(e);
- if(this.useShim){
- this.shim.setVisible(false);
- }
- var newSize;
- if(this.orientation == YAHOO.ext.SplitBar.HORIZONTAL){
- newSize = this.dragSpecs.startSize +
- (this.placement == YAHOO.ext.SplitBar.LEFT ?
- endPoint[0] - this.dragSpecs.startPoint[0] :
- this.dragSpecs.startPoint[0] - endPoint[0]
- );
- }else{
- newSize = this.dragSpecs.startSize +
- (this.placement == YAHOO.ext.SplitBar.TOP ?
- endPoint[1] - this.dragSpecs.startPoint[1] :
- this.dragSpecs.startPoint[1] - endPoint[1]
- );
- }
- newSize = Math.min(Math.max(newSize, this.minSize), this.maxSize);
- if(newSize != this.dragSpecs.startSize){
- this.adapter.setElementSize(this, newSize);
- this.onMoved.fireDirect(this, newSize);
- }
- },
-
- /**
- * Get the adapter this SplitBar uses
- * @return The adapter object
- */
- getAdapter : function(){
- return this.adapter;
- },
-
- /**
- * Set the adapter this SplitBar uses
- * @param {Object} adapter A SplitBar adapter object
- */
- setAdapter : function(adapter){
- this.adapter = adapter;
- this.adapter.init(this);
- },
-
- /**
- * Gets the minimum size for the resizing element
- * @return {Number} The minimum size
- */
- getMinimumSize : function(){
- return this.minSize;
- },
-
- /**
- * Sets the minimum size for the resizing element
- * @param {Number} minSize The minimum size
- */
- setMinimumSize : function(minSize){
- this.minSize = minSize;
- },
-
- /**
- * Gets the maximum size for the resizing element
- * @return {Number} The maximum size
- */
- getMaximumSize : function(){
- return this.maxSize;
- },
-
- /**
- * Sets the maximum size for the resizing element
- * @param {Number} maxSize The maximum size
- */
- setMaximumSize : function(maxSize){
- this.maxSize = maxSize;
- },
-
- /**
- * Sets the initialize size for the resizing element
- * @param {Number} size The initial size
- */
- setCurrentSize : function(size){
- var oldAnimate = this.animate;
- this.animate = false;
- this.adapter.setElementSize(this, size);
- this.animate = oldAnimate;
- }
-};
-
-/**
- * @private static Create the shim to drag over iframes
- */
-YAHOO.ext.SplitBar.createShim = function(){
- var shim = document.createElement('div');
- YAHOO.util.Dom.generateId(shim, 'split-shim');
- YAHOO.util.Dom.setStyle(shim, 'width', '100%');
- YAHOO.util.Dom.setStyle(shim, 'height', '100%');
- YAHOO.util.Dom.setStyle(shim, 'position', 'absolute');
- YAHOO.util.Dom.setStyle(shim, 'background', 'white');
- YAHOO.util.Dom.setStyle(shim, 'visibility', 'hidden');
- YAHOO.util.Dom.setStyle(shim, 'z-index', 2);
- window.document.body.appendChild(shim);
- var shimEl = YAHOO.ext.Element.get(shim);
- shimEl.setOpacity(.01);
- shimEl.setXY([0, 0]);
- return shimEl;
-}
-
-/**
- * @private static Create our own proxy element element. So it will be the same same size on all browsers, we won't use borders. Instead we use a background color.
- */
-YAHOO.ext.SplitBar.createProxy = function(orientation){
- var proxy = document.createElement('div');
- YAHOO.util.Dom.generateId(proxy, 'split-proxy');
- YAHOO.util.Dom.setStyle(proxy, 'position', 'absolute');
- YAHOO.util.Dom.setStyle(proxy, 'visibility', 'hidden');
- YAHOO.util.Dom.setStyle(proxy, 'z-index', 999);
- YAHOO.util.Dom.setStyle(proxy, 'background-color', "#aaa");
- if(orientation == YAHOO.ext.SplitBar.HORIZONTAL){
- YAHOO.util.Dom.setStyle(proxy, 'cursor', 'e-resize');
- }else{
- YAHOO.util.Dom.setStyle(proxy, 'cursor', 'n-resize');
- }
- // the next 2 fix IE abs position div height problem
- YAHOO.util.Dom.setStyle(proxy, 'line-height', '0px');
- YAHOO.util.Dom.setStyle(proxy, 'font-size', '0px');
- window.document.body.appendChild(proxy);
- return proxy;
-}
-
-/**
- * @class
- * Default Adapter. It assumes the splitter and resizing element are not positioned
- * elements and only gets/sets the width of the element. Generally used for table based layouts.
- */
-YAHOO.ext.SplitBar.BasicLayoutAdapter = function(){
-}
-
-YAHOO.ext.SplitBar.BasicLayoutAdapter.prototype = {
- // do nothing for now
- init : function(s){
-
- },
- /**
- * Called before drag operations to get the current size of the resizing element.
- * @param {YAHOO.ext.SplitBar} s The SplitBar using this adapter
- */
- getElementSize : function(s){
- if(s.orientation == YAHOO.ext.SplitBar.HORIZONTAL){
- return s.resizingEl.getWidth();
- }else{
- return s.resizingEl.getHeight();
- }
- },
-
- /**
- * Called after drag operations to set the size of the resizing element.
- * @param {YAHOO.ext.SplitBar} s The SplitBar using this adapter
- * @param {Number} newSize The new size to set
- * @param {Function} onComplete A function to be invoke when resizing is complete
- */
- setElementSize : function(s, newSize, onComplete){
- if(s.orientation == YAHOO.ext.SplitBar.HORIZONTAL){
- if(!YAHOO.util.Anim || !s.animate){
- s.resizingEl.setWidth(newSize);
- if(onComplete){
- onComplete(s, newSize);
- }
- }else{
- s.resizingEl.setWidth(newSize, true, .1, onComplete, YAHOO.util.Easing.easeOut);
- }
- }else{
-
- if(!YAHOO.util.Anim || !s.animate){
- s.resizingEl.setHeight(newSize);
- if(onComplete){
- onComplete(s, newSize);
- }
- }else{
- s.resizingEl.setHeight(newSize, true, .1, onComplete, YAHOO.util.Easing.easeOut);
- }
- }
- }
-};
-
-/**
- *@class
- * Adapter that moves the splitter element to align with the resized sizing element.
- * Used with an absolute positioned SplitBar.
- * @param {String/HTMLElement/Element} container The container that wraps around the absolute positioned content. If it's
- * document.body, make sure you assign an id to the body element.
- */
-YAHOO.ext.SplitBar.AbsoluteLayoutAdapter = function(container){
- this.basic = new YAHOO.ext.SplitBar.BasicLayoutAdapter();
- this.container = getEl(container);
-}
-
-YAHOO.ext.SplitBar.AbsoluteLayoutAdapter.prototype = {
- init : function(s){
- this.basic.init(s);
- //YAHOO.util.Event.on(window, 'resize', this.moveSplitter.createDelegate(this, [s]));
- },
-
- getElementSize : function(s){
- return this.basic.getElementSize(s);
- },
-
- setElementSize : function(s, newSize, onComplete){
- this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s]));
- },
-
- moveSplitter : function(s){
- var yes = YAHOO.ext.SplitBar;
- switch(s.placement){
- case yes.LEFT:
- s.el.setX(s.resizingEl.getRight());
- break;
- case yes.RIGHT:
- s.el.setStyle('right', (this.container.getWidth() - s.resizingEl.getLeft()) + 'px');
- break;
- case yes.TOP:
- s.el.setY(s.resizingEl.getBottom());
- break;
- case yes.BOTTOM:
- s.el.setY(s.resizingEl.getTop() - s.el.getHeight());
- break;
- }
- }
-};
-
-/**
- * Orientation constant - Create a vertical SplitBar
- * @type Number
- */
-YAHOO.ext.SplitBar.VERTICAL = 1;
-
-/**
- * Orientation constant - Create a horizontal SplitBar
- * @type Number
- */
-YAHOO.ext.SplitBar.HORIZONTAL = 2;
-
-/**
- * Placement constant - The resizing element is to the left of the splitter element
- * @type Number
- */
-YAHOO.ext.SplitBar.LEFT = 1;
-
-/**
- * Placement constant - The resizing element is to the right of the splitter element
- * @type Number
- */
-YAHOO.ext.SplitBar.RIGHT = 2;
-
-/**
- * Placement constant - The resizing element is positioned above the splitter element
- * @type Number
- */
-YAHOO.ext.SplitBar.TOP = 3;
-
-/**
- * Placement constant - The resizing element is positioned under splitter element
- * @type Number
- */
-YAHOO.ext.SplitBar.BOTTOM = 4;
diff --git a/www/extras/yui-ext/source/widgets/TabPanel.js b/www/extras/yui-ext/source/widgets/TabPanel.js
deleted file mode 100644
index 20134e4ed..000000000
--- a/www/extras/yui-ext/source/widgets/TabPanel.js
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-/*
- tabpanel.js, version .1
- Copyright(c) 2006, Jack Slocum.
- Code licensed under the BSD License
-*/
-
-/**
- * @class Creates a lightweight TabPanel component using Yahoo! UI.
- *
- // basic tabs 1, built from existing content
- var tabs = new YAHOO.ext.TabPanel('tabs1');
- tabs.addTab('script', "View Script");
- tabs.addTab('markup', "View Markup");
- tabs.activate('script');
-
- // more advanced tabs, built from javascript
- var jtabs = new YAHOO.ext.TabPanel('jtabs');
- jtabs.addTab('jtabs-1', "Normal Tab", "My content was added during construction.");
-
- // set up the UpdateManager
- var tab2 = jtabs.addTab('jtabs-2', "Ajax Tab 1");
- var updater = tab2.getUpdateManager();
- updater.setDefaultUrl('ajax1.htm');
- tab2.onActivate.subscribe(updater.refresh, updater, true);
-
- // Use setUrl for Ajax loading
- var tab3 = jtabs.addTab('jtabs-3', "Ajax Tab 2");
- tab3.setUrl('ajax2.htm', null, true);
-
- // Disabled tab
- var tab4 = jtabs.addTab('tabs1-5', "Disabled Tab", "Can't see me cause I'm disabled");
- tab4.disable();
-
- jtabs.activate('jtabs-1');
-}
- *
- * @requires YAHOO.ext.Element
- * @requires YAHOO.ext.UpdateManager
- * @requires YAHOO.util.Dom
- * @requires YAHOO.util.Event
- * @requires YAHOO.util.CustomEvent
- * @requires YAHOO.util.DDProxy
- * @requires YAHOO.util.Connect (optional)
- * @constructor
- * Create new TabPanel.
- * @param {String/HTMLElement/Element} container The id, DOM element or YAHOO.ext.Element container where this TabPanel is to be rendered.
- */
-YAHOO.ext.TabPanel = function(container, onBottom){
- /**
- * The container element for this TabPanel.
- * @type YAHOO.ext.Element
- */
- this.el = getEl(container);
- if(onBottom){
- this.bodyEl = getEl(this.createBody(this.el.dom));
- this.el.addClass('ytabs-bottom');
- }
- /** @private */
- this.stripWrap = getEl(this.createStrip(this.el.dom));
- /** @private */
- this.stripEl = getEl(this.createStripList(this.stripWrap.dom));
- /** The body element that contains TabPaneItem bodies.
- * @type YAHOO.ext.Element
- */
- if(!onBottom){
- this.bodyEl = getEl(this.createBody(this.el.dom));
- }
- /** @private */
- this.items = {};
- /** @private */
- this.active = null;
- /**
- * Fires when the active TabPanelItem changes. Uses fireDirect with signature: (TabPanel this, TabPanelItem activedTab).
- * @type CustomEvent
- */
- this.onTabChange = new YAHOO.util.CustomEvent('TabItem.onTabChange');
- /** @private */
- this.activateDelegate = this.activate.createDelegate(this);
-}
-
-YAHOO.ext.TabPanel.prototype = {
- /**
- * Creates a new TabPanelItem by looking for an existing element with the provided id - if it's not found it creates one.
- * @param {String} id The id of the div to use or create
- * @param {String} text The text for the tab
- * @param {String} content (optional) Content to put in the TabPanelItem body
- * @return {YAHOO.ext.TabPanelItem} The created TabPanelItem
- */
- addTab : function(id, text, content){
- var item = new YAHOO.ext.TabPanelItem(this, id, text);
- this.addTabItem(item);
- if(content){
- item.setContent(content);
- }
- return item;
- },
-
- /**
- * Returns the TabPanelItem with the specified id
- * @param {String} id The id of the TabPanelItem to fetch.
- * @return {YAHOO.ext.TabPanelItem}
- */
- getTab : function(id){
- return this.items[id];
- },
-
- /**
- * Add an existing TabPanelItem.
- * @param {YAHOO.ext.TabPanelItem} item The TabPanelItem to add
- */
- addTabItem : function(item){
- this.items[item.id] = item;
- },
-
- /**
- * Remove a TabPanelItem.
- * @param {String} id The id of the TabPanelItem to remove.
- */
- removeTab : function(id){
- var tab = this.items[id];
- if(tab && this.active == tab){// if it's active, activate the first tab
- for(var key in this.items){
- if(typeof this.items[key] != 'function' && this.items[key] != tab){
- this.items[key].activate();
- break;
- }
- }
- }
- this.stripEl.dom.removeChild(tab.onEl.dom);
- this.stripEl.dom.removeChild(tab.offEl.dom);
- this.bodyEl.dom.removeChild(tab.bodyEl.dom);
- delete this.items[id];
- },
-
- /**
- * Disable a TabPanelItem. It cannot be the active tab, if it is this call is ignored..
- * @param {String} id The id of the TabPanelItem to disable.
- */
- disableTab : function(id){
- var tab = this.items[id];
- if(tab && this.active != tab){
- tab.disable();
- }
- },
-
- /**
- * Enable a TabPanelItem that is disabled.
- * @param {String} id The id of the TabPanelItem to enable.
- */
- enableTab : function(id){
- var tab = this.items[id];
- tab.enable();
- },
-
- /**
- * Activate a TabPanelItem. The currently active will be deactivated.
- * @param {String} id The id of the TabPanelItem to activate.
- */
- activate : function(id){
- var tab = this.items[id];
- if(!tab.disabled){
- if(this.active){
- this.active.hide();
- }
- this.active = this.items[id];
- this.active.show();
- this.onTabChange.fireDirect(this, this.active);
- }
- },
-
- /**
- * Get the active TabPanelItem
- * @return {YAHOO.ext.TabPanelItem} The active TabPanelItem or null if none are active.
- */
- getActiveTab : function(){
- return this.active;
- }
-
-};
-
-YAHOO.ext.TabPanelItem = function(tabPanel, id, text){
- /**
- * The TabPanel this TabPanelItem belongs to
- * @type YAHOO.ext.TabPanel
- */
- this.tabPanel = tabPanel;
- /**
- * The id for this TabPanelItem
- * @type String
- */
- this.id = id;
- /** @private */
- this.disabled = false;
- /** @private */
- this.text = text;
- /** @private */
- this.loaded = false;
-
- /**
- * The body element for this TabPanelItem
- * @type YAHOO.ext.Element
- */
- this.bodyEl = getEl(tabPanel.createItemBody(tabPanel.bodyEl.dom, id));
- this.bodyEl.originalDisplay = 'block';
- this.bodyEl.setStyle('display', 'none');
- this.bodyEl.enableDisplayMode();
-
- var stripElements =tabPanel.createStripElements(tabPanel.stripEl.dom, text);
- /** @private */
- this.onEl = getEl(stripElements.on, true);
- /** @private */
- this.offEl = getEl(stripElements.off, true);
- this.onEl.originalDisplay = 'inline';
- this.onEl.enableDisplayMode();
- this.offEl.originalDisplay = 'inline';
- this.offEl.enableDisplayMode();
- this.offEl.on('click', tabPanel.activateDelegate.createCallback(id));
- /**
- * Fires when this TabPanelItem is activated. Uses fireDirect with signature: (TabPanel tabPanel, TabPanelItem this).
- * @type CustomEvent
- */
- this.onActivate = new YAHOO.util.CustomEvent('TabItem.onActivate');
- /**
- * Fires when this TabPanelItem is deactivated. Uses fireDirect with signature: (TabPanel tabPanel, TabPanelItem this).
- * @type CustomEvent
- */
- this.onDeactivate = new YAHOO.util.CustomEvent('TabItem.onDeactivate');
-};
-
-YAHOO.ext.TabPanelItem.prototype = {
- /**
- * Show this TabPanelItem - this does not deactivate the currently active TabPanelItem.
- */
- show : function(){
- this.onEl.show();
- this.offEl.hide();
- this.bodyEl.show();
- this.onActivate.fireDirect(this.tabPanel, this);
- },
-
- setText : function(text){
- this.onEl.dom.firstChild.firstChild.firstChild.innerHTML = text;
- this.offEl.dom.firstChild.firstChild.innerHTML = text;
- },
- /**
- * Activate this TabPanelItem - this does deactivate the currently active TabPanelItem.
- */
- activate : function(){
- this.tabPanel.activate(this.id);
- },
-
- /**
- * Hide this TabPanelItem - if you don't activate another TabPanelItem this could look odd.
- */
- hide : function(){
- this.onEl.hide();
- this.offEl.show();
- this.bodyEl.hide();
- this.onDeactivate.fireDirect(this.tabPanel, this);
- },
-
- /**
- * Disable this TabPanelItem - this call is ignore if this is the active TabPanelItem.
- */
- disable : function(){
- if(this.tabPanel.active != this){
- this.disabled = true;
- this.offEl.addClass('disabled');
- this.offEl.dom.title = 'disabled';
- }
- },
-
- /**
- * Enable this TabPanelItem if it was previously disabled.
- */
- enable : function(){
- this.disabled = false;
- this.offEl.removeClass('disabled');
- this.offEl.dom.title = '';
- },
-
- /**
- * Set the content for this TabPanelItem.
- * @param {String} content The content
- */
- setContent : function(content){
- this.bodyEl.update(content);
- },
-
- /**
- * Get the {@link YAHOO.ext.UpdateManager} for the body of this TabPanelItem. Enables you to perform Ajax updates.
- * @return {YAHOO.ext.UpdateManager} The UpdateManager
- */
- getUpdateManager : function(){
- return this.bodyEl.getUpdateManager();
- },
-
- /**
- * Set a URL to be used to load the content for this TabPanelItem.
- * @param {String/Function} url The url to load the content from or a function to call to get the url
- * @param {String/Object} params (optional) The string params for the update call or an object of the params. See {@link YAHOO.ext.UpdateManager#update} for more details. (Defaults to null)
- * @param {Boolean} loadOnce (optional) Whether to only load the content once. If this is false it makes the Ajax call every time this TabPanelItem is activated. (Defaults to false)
- * @return {YAHOO.ext.UpdateManager} The UpdateManager
- */
- setUrl : function(url, params, loadOnce){
- this.onActivate.subscribe(this._handleRefresh.createDelegate(this, [url, params, loadOnce]));
- },
-
- /** @private */
- _handleRefresh : function(url, params, loadOnce){
- if(!loadOnce || !this.loaded){
- var updater = this.bodyEl.getUpdateManager();
- updater.update(url, params, this._setLoaded.createDelegate(this));
- }
- },
-
- /** @private */
- _setLoaded : function(){
- this.loaded = true;
- }
-};
-/** @private */
-YAHOO.ext.TabPanel.prototype.createStrip = function(container){
- var strip = document.createElement('div');
- YAHOO.util.Dom.addClass(strip, 'tabset');
- container.appendChild(strip);
- var stripInner = document.createElement('div');
- YAHOO.util.Dom.generateId(stripInner, 'tab-strip');
- YAHOO.util.Dom.addClass(stripInner, 'hd');
- strip.appendChild(stripInner);
- return stripInner;
-};
-/** @private */
-YAHOO.ext.TabPanel.prototype.createStripList = function(strip){
- var list = document.createElement('ul');
- YAHOO.util.Dom.generateId(list, 'tab-strip-list');
- strip.appendChild(list);
- return list;
-};
-/** @private */
-YAHOO.ext.TabPanel.prototype.createBody = function(container){
- var body = document.createElement('div');
- YAHOO.util.Dom.generateId(body, 'tab-body');
- YAHOO.util.Dom.addClass(body, 'yui-ext-tabbody');
- container.appendChild(body);
- return body;
-};
-/** @private */
-YAHOO.ext.TabPanel.prototype.createItemBody = function(bodyEl, id){
- var body = YAHOO.util.Dom.get(id);
- if(!body){
- body = document.createElement('div');
- body.id = id;
- }
- YAHOO.util.Dom.addClass(body, 'yui-ext-tabitembody');
- bodyEl.appendChild(body);
- return body;
-};
-/** @private */
-YAHOO.ext.TabPanel.prototype.createStripElements = function(stripEl, text){
- var li = document.createElement('li');
- var a = document.createElement('a');
- var em = document.createElement('em');
-
- stripEl.appendChild(li);
- li.appendChild(a);
- a.appendChild(em);
- em.innerHTML = text;
-
- var li2 = document.createElement('li');
- var a2 = document.createElement('a');
- var em2 = document.createElement('em');
- var strong = document.createElement('strong');
-
- stripEl.appendChild(li2);
- YAHOO.util.Dom.addClass(li2, 'on');
- YAHOO.util.Dom.setStyle(li2, 'display', 'none');
- li2.appendChild(a2);
- a2.appendChild(strong);
- strong.appendChild(em2);
- em2.innerHTML = text;
-
- return {on: li2, off: li};
-};
\ No newline at end of file
diff --git a/www/extras/yui-ext/source/widgets/Toolbar.js b/www/extras/yui-ext/source/widgets/Toolbar.js
deleted file mode 100644
index 6253c12a6..000000000
--- a/www/extras/yui-ext/source/widgets/Toolbar.js
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * YUI Extensions
- * Copyright(c) 2006, Jack Slocum.
- *
- * This code is licensed under BSD license.
- * http://www.opensource.org/licenses/bsd-license.php
- */
-
-/**
- * @class
- * Basic Toolbar used by the Grid to create the paging toolbar. This class is reusable but functionality
- * is limited. Look for more functionality in a future version.
- */
- YAHOO.ext.Toolbar = function(container){
- this.el = getEl(container, true);
- var div = document.createElement('div');
- div.className = 'ytoolbar';
- var tb = document.createElement('table');
- tb.border = 0;
- tb.cellPadding = 0;
- tb.cellSpacing = 0;
- div.appendChild(tb);
- var tbody = document.createElement('tbody');
- tb.appendChild(tbody);
- var tr = document.createElement('tr');
- tbody.appendChild(tr);
- this.el.dom.appendChild(div);
- this.tr = tr;
-};
-
-YAHOO.ext.Toolbar.prototype = {
- /**
- * Adds element(s) to the toolbar - this function takes a variable number of
- * arguments of mixed type and adds them to the toolbar...
- * If an argument is a ToolbarButton, it is added. If the element is a string, it is wrapped
- * in a ytb-text element and added unless the text is "separator" in which case a separator
- * is added. Otherwise, it is assumed the element is an HTMLElement and it is added directly.
- */
- add : function(){
- for(var i = 0; i < arguments.length; i++){
- var el = arguments[i];
- var td = document.createElement('td');
- this.tr.appendChild(td);
- if(el instanceof YAHOO.ext.ToolbarButton){
- el.init(td);
- }else if(typeof el == 'string'){
- var span = document.createElement('span');
- if(el == 'separator'){
- span.className = 'ytb-sep';
- }else{
- span.innerHTML = el;
- span.className = 'ytb-text';
- }
- td.appendChild(span);
- }else if(typeof el == 'object'){ // must be element?
- td.appendChild(el);
- }
- }
- },
-
- addSeparator : function(){
- var td = document.createElement('td');
- this.tr.appendChild(td);
- var span = document.createElement('span');
- span.className = 'ytb-sep';
- td.appendChild(span);
- },
-
- /**
- * Adds a button, see {@link YAHOO.ext.ToolbarButton} for more info on the config
- * @return {YAHOO.ext.ToolbarButton}
- */
- addButton : function(config){
- var b = new YAHOO.ext.ToolbarButton(config);
- this.add(b);
- return b;
- },
-
- addText : function(text){
- var td = document.createElement('td');
- this.tr.appendChild(td);
- var span = document.createElement('span');
- span.className = 'ytb-text';
- span.innerHTML = text;
- td.appendChild(span);
- return span;
- }
-};
-
-/**
- * @class
- * A toolbar button. The config has the following options:
- * myFunction.createCallback(myarg, myarg2)
- * Will create a function that is bound to those 2 args.
- * @addon
- * @return {Function} The new function
-*/
-Function.prototype.createCallback = function(/*args...*/){
- // make args available, in function below
- var args = arguments;
- var method = this;
- return function() {
- return method.apply(window, args);
- }
-};
-
-/**
- * Creates a delegate (callback) that sets the scope to obj.
- * Call directly on any function. Example: this.myFunction.createDelegate(this)
- * Will create a function that is automatically scoped to this.
- * @addon
- * @param {Object} obj The object for which the scope is set
- * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)
- * @param {Boolean} appendArgs (optional) if True args are appended to call args instead of overriding
- * @return {Function} The new function
- */
-Function.prototype.createDelegate = function(obj, args, appendArgs){
- var method = this;
- return function() {
- var callargs = args || arguments;
- if(appendArgs){
- callargs = Array.prototype.concat.apply(arguments, args);
- }
- return method.apply(obj || window, callargs);
- }
-};
-
-/**
- * Create a combined function call sequence of the original function + the passed function.
- * The resulting function returns the results of the original function.
- * The passed fcn is called with the parameters of the original function
- * @addon
- * @param {Function} fcn The function to sequence
- * @param {Object} scope (optional) The scope of the passed fcn (Defaults to scope of original function or window)
- * @return {Function} The new function
- */
-Function.prototype.createSequence = function(fcn, scope){
- if(typeof fcn != 'function'){
- return this;
- }
- var method = this;
- return function() {
- var retval = method.apply(this || window, arguments);
- fcn.apply(scope || this || window, arguments);
- return retval;
- }
-};
-
-/**
- * Creates an interceptor function. The passed fcn is called before the original one. If it returns false, the original one is not called.
- * The resulting function returns the results of the original function.
- * The passed fcn is called with the parameters of the original function.
- * @addon
- * @param {Function} fcn The function to call before the original
- * @param {Object} scope (optional) The scope of the passed fcn (Defaults to scope of original function or window)
- * @return {Function} The new function
- */
-Function.prototype.createInterceptor = function(fcn, scope){
- if(typeof fcn != 'function'){
- return this;
- }
- var method = this;
- return function() {
- fcn.target = this;
- fcn.method = method;
- if(fcn.apply(scope || this || window, arguments) === false)
- return;
- return method.apply(this || window, arguments);;
- }
-};
-
-/**
- * @class
- * @constructor
- */
-YAHOO.ext.util.Browser = new function(){
- var ua = navigator.userAgent.toLowerCase();
- /** @type Boolean */
- this.isOpera = (ua.indexOf('opera') > -1);
- /** @type Boolean */
- this.isSafari = (ua.indexOf('webkit') > -1);
- /** @type Boolean */
- this.isIE = (window.ActiveXObject);
- /** @type Boolean */
- this.isIE7 = (ua.indexOf('msie 7') > -1);
- /** @type Boolean */
- this.isGecko = !this.isSafari && (ua.indexOf('gecko') > -1);
-}();
-
-/**
- * Enable custom handler signature and event cancelling. Using fireDirect() instead of fire() calls the subscribed event handlers
- * with the exact parameters passed to fireDirect, instead of the usual (eventType, args[], obj). IMO this is more intuitive
- * and promotes cleaner code. Also, if an event handler returns false, it is returned by fireDirect and no other handlers will be called.
- * if(beforeUpdateEvent.fireDirect(myArg, myArg2) !== false){
- * // do update
- * }
- * @addon
- */
-YAHOO.util.CustomEvent.prototype.fireDirect = function(){
- var len=this.subscribers.length;
- for (var i=0; i