Improve output: distinguish between failed assertions (failures) and unexpected exceptions (errors), and print a filtered stack trace for any exception.
This commit is contained in:
commit
4f2e303079
1839 changed files with 235630 additions and 0 deletions
476
webapp/web/src/lfx/Animation.js
Normal file
476
webapp/web/src/lfx/Animation.js
Normal file
|
@ -0,0 +1,476 @@
|
|||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.lfx.Animation");
|
||||
dojo.provide("dojo.lfx.Line");
|
||||
|
||||
dojo.require("dojo.lang.func");
|
||||
|
||||
/*
|
||||
Animation package based on Dan Pupius' work: http://pupius.co.uk/js/Toolkit.Drawing.js
|
||||
*/
|
||||
dojo.lfx.Line = function(start, end){
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
if(dojo.lang.isArray(start)){
|
||||
var diff = [];
|
||||
dojo.lang.forEach(this.start, function(s,i){
|
||||
diff[i] = this.end[i] - s;
|
||||
}, this);
|
||||
|
||||
this.getValue = function(/*float*/ n){
|
||||
var res = [];
|
||||
dojo.lang.forEach(this.start, function(s, i){
|
||||
res[i] = (diff[i] * n) + s;
|
||||
}, this);
|
||||
return res;
|
||||
}
|
||||
}else{
|
||||
var diff = end - start;
|
||||
|
||||
this.getValue = function(/*float*/ n){
|
||||
// summary: returns the point on the line
|
||||
// n: a floating point number greater than 0 and less than 1
|
||||
return (diff * n) + this.start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dojo.lfx.easeIn = function(n){
|
||||
// summary: returns the point on an easing curve
|
||||
// n: a floating point number greater than 0 and less than 1
|
||||
return Math.pow(n, 3);
|
||||
}
|
||||
|
||||
dojo.lfx.easeOut = function(n){
|
||||
// summary: returns the point on the line
|
||||
// n: a floating point number greater than 0 and less than 1
|
||||
return ( 1 - Math.pow(1 - n, 3) );
|
||||
}
|
||||
|
||||
dojo.lfx.easeInOut = function(n){
|
||||
// summary: returns the point on the line
|
||||
// n: a floating point number greater than 0 and less than 1
|
||||
return ( (3 * Math.pow(n, 2)) - (2 * Math.pow(n, 3)) );
|
||||
}
|
||||
|
||||
dojo.lfx.IAnimation = function(){}
|
||||
dojo.lang.extend(dojo.lfx.IAnimation, {
|
||||
// public properties
|
||||
curve: null,
|
||||
duration: 1000,
|
||||
easing: null,
|
||||
repeatCount: 0,
|
||||
rate: 25,
|
||||
|
||||
// events
|
||||
handler: null,
|
||||
beforeBegin: null,
|
||||
onBegin: null,
|
||||
onAnimate: null,
|
||||
onEnd: null,
|
||||
onPlay: null,
|
||||
onPause: null,
|
||||
onStop: null,
|
||||
|
||||
// public methods
|
||||
play: null,
|
||||
pause: null,
|
||||
stop: null,
|
||||
|
||||
fire: function(evt, args){
|
||||
if(this[evt]){
|
||||
this[evt].apply(this, (args||[]));
|
||||
}
|
||||
},
|
||||
|
||||
// private properties
|
||||
_active: false,
|
||||
_paused: false
|
||||
});
|
||||
|
||||
dojo.lfx.Animation = function(/*Object*/ handlers, /*int*/ duration, /*Array*/ curve, /*function*/ easing, /*int*/ repeatCount, /*int*/ rate){
|
||||
// summary
|
||||
// a generic animation object that fires callbacks into it's handlers
|
||||
// object at various states
|
||||
// handlers
|
||||
// object {
|
||||
// handler: function(){},
|
||||
// onstart: function(){},
|
||||
// onstop: function(){},
|
||||
// onanimate: function(){}
|
||||
// }
|
||||
dojo.lfx.IAnimation.call(this);
|
||||
if(dojo.lang.isNumber(handlers)||(!handlers && duration.getValue)){
|
||||
// no handlers argument:
|
||||
rate = repeatCount;
|
||||
repeatCount = easing;
|
||||
easing = curve;
|
||||
curve = duration;
|
||||
duration = handlers;
|
||||
handlers = null;
|
||||
}else if(handlers.getValue||dojo.lang.isArray(handlers)){
|
||||
// no handlers or duration:
|
||||
rate = easing;
|
||||
repeatCount = curve;
|
||||
easing = duration;
|
||||
curve = handlers;
|
||||
duration = null;
|
||||
handlers = null;
|
||||
}
|
||||
if(dojo.lang.isArray(curve)){
|
||||
this.curve = new dojo.lfx.Line(curve[0], curve[1]);
|
||||
}else{
|
||||
this.curve = curve;
|
||||
}
|
||||
if(duration != null && duration > 0){ this.duration = duration; }
|
||||
if(repeatCount){ this.repeatCount = repeatCount; }
|
||||
if(rate){ this.rate = rate; }
|
||||
if(handlers){
|
||||
this.handler = handlers.handler;
|
||||
this.beforeBegin = handlers.beforeBegin;
|
||||
this.onBegin = handlers.onBegin;
|
||||
this.onEnd = handlers.onEnd;
|
||||
this.onPlay = handlers.onPlay;
|
||||
this.onPause = handlers.onPause;
|
||||
this.onStop = handlers.onStop;
|
||||
this.onAnimate = handlers.onAnimate;
|
||||
}
|
||||
if(easing && dojo.lang.isFunction(easing)){
|
||||
this.easing=easing;
|
||||
}
|
||||
}
|
||||
dojo.inherits(dojo.lfx.Animation, dojo.lfx.IAnimation);
|
||||
dojo.lang.extend(dojo.lfx.Animation, {
|
||||
// "private" properties
|
||||
_startTime: null,
|
||||
_endTime: null,
|
||||
_timer: null,
|
||||
_percent: 0,
|
||||
_startRepeatCount: 0,
|
||||
|
||||
// public methods
|
||||
play: function(delay, gotoStart){
|
||||
if(gotoStart){
|
||||
clearTimeout(this._timer);
|
||||
this._active = false;
|
||||
this._paused = false;
|
||||
this._percent = 0;
|
||||
}else if(this._active && !this._paused){
|
||||
return this;
|
||||
}
|
||||
|
||||
this.fire("handler", ["beforeBegin"]);
|
||||
this.fire("beforeBegin");
|
||||
|
||||
if(delay > 0){
|
||||
setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
|
||||
return this;
|
||||
}
|
||||
|
||||
this._startTime = new Date().valueOf();
|
||||
if(this._paused){
|
||||
this._startTime -= (this.duration * this._percent / 100);
|
||||
}
|
||||
this._endTime = this._startTime + this.duration;
|
||||
|
||||
this._active = true;
|
||||
this._paused = false;
|
||||
|
||||
var step = this._percent / 100;
|
||||
var value = this.curve.getValue(step);
|
||||
if( this._percent == 0 ) {
|
||||
if(!this._startRepeatCount) {
|
||||
this._startRepeatCount = this.repeatCount;
|
||||
}
|
||||
this.fire("handler", ["begin", value]);
|
||||
this.fire("onBegin", [value]);
|
||||
}
|
||||
|
||||
this.fire("handler", ["play", value]);
|
||||
this.fire("onPlay", [value]);
|
||||
|
||||
this._cycle();
|
||||
return this;
|
||||
},
|
||||
|
||||
pause: function() {
|
||||
clearTimeout(this._timer);
|
||||
if(!this._active){ return this; }
|
||||
this._paused = true;
|
||||
var value = this.curve.getValue(this._percent / 100);
|
||||
this.fire("handler", ["pause", value]);
|
||||
this.fire("onPause", [value]);
|
||||
return this;
|
||||
},
|
||||
|
||||
gotoPercent: function(pct, andPlay) {
|
||||
clearTimeout(this._timer);
|
||||
this._active = true;
|
||||
this._paused = true;
|
||||
this._percent = pct;
|
||||
if( andPlay ) { this.play(); }
|
||||
},
|
||||
|
||||
stop: function(gotoEnd) {
|
||||
clearTimeout(this._timer);
|
||||
var step = this._percent / 100;
|
||||
if( gotoEnd ) {
|
||||
step = 1;
|
||||
}
|
||||
var value = this.curve.getValue(step);
|
||||
this.fire("handler", ["stop", value]);
|
||||
this.fire("onStop", [value]);
|
||||
this._active = false;
|
||||
this._paused = false;
|
||||
return this;
|
||||
},
|
||||
|
||||
status: function() {
|
||||
if( this._active ) {
|
||||
return this._paused ? "paused" : "playing";
|
||||
} else {
|
||||
return "stopped";
|
||||
}
|
||||
},
|
||||
|
||||
// "private" methods
|
||||
_cycle: function() {
|
||||
clearTimeout(this._timer);
|
||||
if(this._active){
|
||||
var curr = new Date().valueOf();
|
||||
var step = (curr - this._startTime) / (this._endTime - this._startTime);
|
||||
|
||||
if(step >= 1){
|
||||
step = 1;
|
||||
this._percent = 100;
|
||||
}else{
|
||||
this._percent = step * 100;
|
||||
}
|
||||
|
||||
// Perform easing
|
||||
if((this.easing)&&(dojo.lang.isFunction(this.easing))){
|
||||
step = this.easing(step);
|
||||
}
|
||||
|
||||
var value = this.curve.getValue(step);
|
||||
this.fire("handler", ["animate", value]);
|
||||
this.fire("onAnimate", [value]);
|
||||
|
||||
if( step < 1 ) {
|
||||
this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate);
|
||||
} else {
|
||||
this._active = false;
|
||||
this.fire("handler", ["end"]);
|
||||
this.fire("onEnd");
|
||||
|
||||
if( this.repeatCount > 0 ) {
|
||||
this.repeatCount--;
|
||||
this.play(null, true);
|
||||
} else if( this.repeatCount == -1 ) {
|
||||
this.play(null, true);
|
||||
} else {
|
||||
if(this._startRepeatCount) {
|
||||
this.repeatCount = this._startRepeatCount;
|
||||
this._startRepeatCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
dojo.lfx.Combine = function(){
|
||||
dojo.lfx.IAnimation.call(this);
|
||||
this._anims = [];
|
||||
this._animsEnded = 0;
|
||||
|
||||
var anims = arguments;
|
||||
if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){
|
||||
anims = anims[0];
|
||||
}
|
||||
|
||||
var _this = this;
|
||||
dojo.lang.forEach(anims, function(anim){
|
||||
_this._anims.push(anim);
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){ oldOnEnd(); _this._onAnimsEnded(); };
|
||||
});
|
||||
}
|
||||
dojo.inherits(dojo.lfx.Combine, dojo.lfx.IAnimation);
|
||||
dojo.lang.extend(dojo.lfx.Combine, {
|
||||
// private members
|
||||
_animsEnded: 0,
|
||||
|
||||
// public methods
|
||||
play: function(delay, gotoStart){
|
||||
if( !this._anims.length ){ return this; }
|
||||
|
||||
this.fire("beforeBegin");
|
||||
|
||||
if(delay > 0){
|
||||
setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
|
||||
return this;
|
||||
}
|
||||
|
||||
if(gotoStart || this._anims[0].percent == 0){
|
||||
this.fire("onBegin");
|
||||
}
|
||||
this.fire("onPlay");
|
||||
this._animsCall("play", null, gotoStart);
|
||||
return this;
|
||||
},
|
||||
|
||||
pause: function(){
|
||||
this.fire("onPause");
|
||||
this._animsCall("pause");
|
||||
return this;
|
||||
},
|
||||
|
||||
stop: function(gotoEnd){
|
||||
this.fire("onStop");
|
||||
this._animsCall("stop", gotoEnd);
|
||||
return this;
|
||||
},
|
||||
|
||||
// private methods
|
||||
_onAnimsEnded: function(){
|
||||
this._animsEnded++;
|
||||
if(this._animsEnded >= this._anims.length){
|
||||
this.fire("onEnd");
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
_animsCall: function(funcName){
|
||||
var args = [];
|
||||
if(arguments.length > 1){
|
||||
for(var i = 1 ; i < arguments.length ; i++){
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
}
|
||||
var _this = this;
|
||||
dojo.lang.forEach(this._anims, function(anim){
|
||||
anim[funcName](args);
|
||||
}, _this);
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
dojo.lfx.Chain = function() {
|
||||
dojo.lfx.IAnimation.call(this);
|
||||
this._anims = [];
|
||||
this._currAnim = -1;
|
||||
|
||||
var anims = arguments;
|
||||
if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){
|
||||
anims = anims[0];
|
||||
}
|
||||
|
||||
var _this = this;
|
||||
dojo.lang.forEach(anims, function(anim, i, anims_arr){
|
||||
_this._anims.push(anim);
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
if(i < anims_arr.length - 1){
|
||||
anim.onEnd = function(){ oldOnEnd(); _this._playNext(); };
|
||||
}else{
|
||||
anim.onEnd = function(){ oldOnEnd(); _this.fire("onEnd"); };
|
||||
}
|
||||
}, _this);
|
||||
}
|
||||
dojo.inherits(dojo.lfx.Chain, dojo.lfx.IAnimation);
|
||||
dojo.lang.extend(dojo.lfx.Chain, {
|
||||
// private members
|
||||
_currAnim: -1,
|
||||
|
||||
// public methods
|
||||
play: function(delay, gotoStart){
|
||||
if( !this._anims.length ) { return this; }
|
||||
if( gotoStart || !this._anims[this._currAnim] ) {
|
||||
this._currAnim = 0;
|
||||
}
|
||||
|
||||
var currentAnimation = this._anims[this._currAnim];
|
||||
|
||||
this.fire("beforeBegin");
|
||||
if(delay > 0){
|
||||
setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
|
||||
return this;
|
||||
}
|
||||
|
||||
if(currentAnimation){
|
||||
if(this._currAnim == 0){
|
||||
this.fire("handler", ["begin", this._currAnim]);
|
||||
this.fire("onBegin", [this._currAnim]);
|
||||
}
|
||||
this.fire("onPlay", [this._currAnim]);
|
||||
currentAnimation.play(null, gotoStart);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
pause: function(){
|
||||
if( this._anims[this._currAnim] ) {
|
||||
this._anims[this._currAnim].pause();
|
||||
this.fire("onPause", [this._currAnim]);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
playPause: function(){
|
||||
if(this._anims.length == 0){ return this; }
|
||||
if(this._currAnim == -1){ this._currAnim = 0; }
|
||||
var currAnim = this._anims[this._currAnim];
|
||||
if( currAnim ) {
|
||||
if( !currAnim._active || currAnim._paused ) {
|
||||
this.play();
|
||||
} else {
|
||||
this.pause();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
stop: function(){
|
||||
var currAnim = this._anims[this._currAnim];
|
||||
if(currAnim){
|
||||
currAnim.stop();
|
||||
this.fire("onStop", [this._currAnim]);
|
||||
}
|
||||
return currAnim;
|
||||
},
|
||||
|
||||
// private methods
|
||||
_playNext: function(){
|
||||
if( this._currAnim == -1 || this._anims.length == 0 ) { return this; }
|
||||
this._currAnim++;
|
||||
if( this._anims[this._currAnim] ){
|
||||
this._anims[this._currAnim].play(null, true);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
dojo.lfx.combine = function(){
|
||||
var anims = arguments;
|
||||
if(dojo.lang.isArray(arguments[0])){
|
||||
anims = arguments[0];
|
||||
}
|
||||
return new dojo.lfx.Combine(anims);
|
||||
}
|
||||
|
||||
dojo.lfx.chain = function(){
|
||||
var anims = arguments;
|
||||
if(dojo.lang.isArray(arguments[0])){
|
||||
anims = arguments[0];
|
||||
}
|
||||
return new dojo.lfx.Chain(anims);
|
||||
}
|
15
webapp/web/src/lfx/__package__.js
Normal file
15
webapp/web/src/lfx/__package__.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.kwCompoundRequire({
|
||||
browser: ["dojo.lfx.html"],
|
||||
dashboard: ["dojo.lfx.html"]
|
||||
});
|
||||
dojo.provide("dojo.lfx.*");
|
119
webapp/web/src/lfx/extras.js
Normal file
119
webapp/web/src/lfx/extras.js
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.lfx.extras");
|
||||
|
||||
dojo.require("dojo.lfx.html");
|
||||
dojo.require("dojo.lfx.Animation");
|
||||
|
||||
dojo.lfx.html.fadeWipeIn = function(nodes, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anim = dojo.lfx.combine(
|
||||
dojo.lfx.wipeIn(nodes, duration, easing),
|
||||
dojo.lfx.fadeIn(nodes, duration, easing));
|
||||
|
||||
if(callback){
|
||||
dojo.event.connect(anim, "onEnd", function(){
|
||||
callback(nodes, anim);
|
||||
});
|
||||
}
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html.fadeWipeOut = function(nodes, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anim = dojo.lfx.combine(
|
||||
dojo.lfx.wipeOut(nodes, duration, easing),
|
||||
dojo.lfx.fadeOut(nodes, duration, easing));
|
||||
|
||||
if(callback){
|
||||
dojo.event.connect(anim, "onEnd", function(){
|
||||
callback(nodes, anim);
|
||||
});
|
||||
}
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html.scale = function(nodes, percentage, scaleContent, fromCenter, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anims = [];
|
||||
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
var origWidth = dojo.style.getOuterWidth(node);
|
||||
var origHeight = dojo.style.getOuterHeight(node);
|
||||
|
||||
var actualPct = percentage/100.0;
|
||||
var props = [
|
||||
{ property: "width",
|
||||
start: origWidth,
|
||||
end: origWidth * actualPct
|
||||
},
|
||||
{ property: "height",
|
||||
start: origHeight,
|
||||
end: origHeight * actualPct
|
||||
}];
|
||||
|
||||
if(scaleContent){
|
||||
var fontSize = dojo.style.getStyle(node, 'font-size');
|
||||
var fontSizeType = null;
|
||||
if(!fontSize){
|
||||
fontSize = parseFloat('100%');
|
||||
fontSizeType = '%';
|
||||
}else{
|
||||
dojo.lang.some(['em','px','%'], function(item, index, arr){
|
||||
if(fontSize.indexOf(item)>0){
|
||||
fontSize = parseFloat(fontSize);
|
||||
fontSizeType = item;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
props.push({
|
||||
property: "font-size",
|
||||
start: fontSize,
|
||||
end: fontSize * actualPct,
|
||||
units: fontSizeType });
|
||||
}
|
||||
|
||||
if(fromCenter){
|
||||
var positioning = dojo.style.getStyle(node, "position");
|
||||
var originalTop = node.offsetTop;
|
||||
var originalLeft = node.offsetLeft;
|
||||
var endTop = ((origHeight * actualPct) - origHeight)/2;
|
||||
var endLeft = ((origWidth * actualPct) - origWidth)/2;
|
||||
props.push({
|
||||
property: "top",
|
||||
start: originalTop,
|
||||
end: (positioning == "absolute" ? originalTop - endTop : (-1*endTop))
|
||||
});
|
||||
props.push({
|
||||
property: "left",
|
||||
start: originalLeft,
|
||||
end: (positioning == "absolute" ? originalLeft - endLeft : (-1*endLeft))
|
||||
});
|
||||
}
|
||||
|
||||
var anim = dojo.lfx.propertyAnimation(node, props, duration, easing);
|
||||
if(callback){
|
||||
dojo.event.connect(anim, "onEnd", function(){
|
||||
callback(node, anim);
|
||||
});
|
||||
}
|
||||
|
||||
anims.push(anim);
|
||||
});
|
||||
|
||||
if(nodes.length > 1){ return dojo.lfx.combine(anims); }
|
||||
else{ return anims[0]; }
|
||||
}
|
||||
|
||||
dojo.lang.mixin(dojo.lfx, dojo.lfx.html);
|
535
webapp/web/src/lfx/html.js
Normal file
535
webapp/web/src/lfx/html.js
Normal file
|
@ -0,0 +1,535 @@
|
|||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.lfx.html");
|
||||
dojo.require("dojo.lfx.Animation");
|
||||
|
||||
dojo.require("dojo.html");
|
||||
|
||||
dojo.lfx.html._byId = function(nodes){
|
||||
if(!nodes){ return []; }
|
||||
if(dojo.lang.isArray(nodes)){
|
||||
if(!nodes.alreadyChecked){
|
||||
var n = [];
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
n.push(dojo.byId(node));
|
||||
});
|
||||
n.alreadyChecked = true;
|
||||
return n;
|
||||
}else{
|
||||
return nodes;
|
||||
}
|
||||
}else{
|
||||
var n = [];
|
||||
n.push(dojo.byId(nodes));
|
||||
n.alreadyChecked = true;
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
dojo.lfx.html.propertyAnimation = function( /*DOMNode*/ nodes,
|
||||
/*Array*/ propertyMap,
|
||||
/*int*/ duration,
|
||||
/*function*/ easing){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
|
||||
if(nodes.length==1){
|
||||
// FIXME: we're only supporting start-value filling when one node is
|
||||
// passed
|
||||
|
||||
dojo.lang.forEach(propertyMap, function(prop){
|
||||
if(typeof prop["start"] == "undefined"){
|
||||
if(prop.property != "opacity"){
|
||||
prop.start = parseInt(dojo.style.getComputedStyle(nodes[0], prop.property));
|
||||
}else{
|
||||
prop.start = dojo.style.getOpacity(nodes[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var coordsAsInts = function(coords){
|
||||
var cints = new Array(coords.length);
|
||||
for(var i = 0; i < coords.length; i++){
|
||||
cints[i] = Math.round(coords[i]);
|
||||
}
|
||||
return cints;
|
||||
}
|
||||
var setStyle = function(n, style){
|
||||
n = dojo.byId(n);
|
||||
if(!n || !n.style){ return; }
|
||||
for(var s in style){
|
||||
if(s == "opacity"){
|
||||
dojo.style.setOpacity(n, style[s]);
|
||||
}else{
|
||||
n.style[s] = style[s];
|
||||
}
|
||||
}
|
||||
}
|
||||
var propLine = function(properties){
|
||||
this._properties = properties;
|
||||
this.diffs = new Array(properties.length);
|
||||
dojo.lang.forEach(properties, function(prop, i){
|
||||
// calculate the end - start to optimize a bit
|
||||
if(dojo.lang.isArray(prop.start)){
|
||||
// don't loop through the arrays
|
||||
this.diffs[i] = null;
|
||||
}else if(prop.start instanceof dojo.graphics.color.Color){
|
||||
// save these so we don't have to call toRgb() every getValue() call
|
||||
prop.startRgb = prop.start.toRgb();
|
||||
prop.endRgb = prop.end.toRgb();
|
||||
}else{
|
||||
this.diffs[i] = prop.end - prop.start;
|
||||
}
|
||||
}, this);
|
||||
this.getValue = function(n){
|
||||
var ret = {};
|
||||
dojo.lang.forEach(this._properties, function(prop, i){
|
||||
var value = null;
|
||||
if(dojo.lang.isArray(prop.start)){
|
||||
// FIXME: what to do here?
|
||||
}else if(prop.start instanceof dojo.graphics.color.Color){
|
||||
value = (prop.units||"rgb") + "(";
|
||||
for(var j = 0 ; j < prop.startRgb.length ; j++){
|
||||
value += Math.round(((prop.endRgb[j] - prop.startRgb[j]) * n) + prop.startRgb[j]) + (j < prop.startRgb.length - 1 ? "," : "");
|
||||
}
|
||||
value += ")";
|
||||
}else{
|
||||
value = ((this.diffs[i]) * n) + prop.start + (prop.property != "opacity" ? prop.units||"px" : "");
|
||||
}
|
||||
ret[dojo.style.toCamelCase(prop.property)] = value;
|
||||
}, this);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
var anim = new dojo.lfx.Animation({
|
||||
onAnimate: function(propValues){
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
setStyle(node, propValues);
|
||||
});
|
||||
} }, duration, new propLine(propertyMap), easing);
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html._makeFadeable = function(nodes){
|
||||
var makeFade = function(node){
|
||||
if(dojo.render.html.ie){
|
||||
// only set the zoom if the "tickle" value would be the same as the
|
||||
// default
|
||||
if( (node.style.zoom.length == 0) &&
|
||||
(dojo.style.getStyle(node, "zoom") == "normal") ){
|
||||
// make sure the node "hasLayout"
|
||||
// NOTE: this has been tested with larger and smaller user-set text
|
||||
// sizes and works fine
|
||||
node.style.zoom = "1";
|
||||
// node.style.zoom = "normal";
|
||||
}
|
||||
// don't set the width to auto if it didn't already cascade that way.
|
||||
// We don't want to f anyones designs
|
||||
if( (node.style.width.length == 0) &&
|
||||
(dojo.style.getStyle(node, "width") == "auto") ){
|
||||
node.style.width = "auto";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dojo.lang.isArrayLike(nodes)){
|
||||
dojo.lang.forEach(nodes, makeFade);
|
||||
}else{
|
||||
makeFade(nodes);
|
||||
}
|
||||
}
|
||||
|
||||
dojo.lfx.html.fadeIn = function(nodes, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
dojo.lfx.html._makeFadeable(nodes);
|
||||
var anim = dojo.lfx.propertyAnimation(nodes, [
|
||||
{ property: "opacity",
|
||||
start: dojo.style.getOpacity(nodes[0]),
|
||||
end: 1 } ], duration, easing);
|
||||
if(callback){
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){ oldOnEnd(); callback(nodes, anim); };
|
||||
}
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html.fadeOut = function(nodes, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
dojo.lfx.html._makeFadeable(nodes);
|
||||
var anim = dojo.lfx.propertyAnimation(nodes, [
|
||||
{ property: "opacity",
|
||||
start: dojo.style.getOpacity(nodes[0]),
|
||||
end: 0 } ], duration, easing);
|
||||
if(callback){
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){ oldOnEnd(); callback(nodes, anim); };
|
||||
}
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html.fadeShow = function(nodes, duration, easing, callback){
|
||||
var anim = dojo.lfx.html.fadeIn(nodes, duration, easing, callback);
|
||||
var oldBb = (anim["beforeBegin"]) ? dojo.lang.hitch(anim, "beforeBegin") : function(){};
|
||||
anim.beforeBegin = function(){
|
||||
oldBb();
|
||||
if(dojo.lang.isArrayLike(nodes)){
|
||||
dojo.lang.forEach(nodes, dojo.style.show);
|
||||
}else{
|
||||
dojo.style.show(nodes);
|
||||
}
|
||||
};
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html.fadeHide = function(nodes, duration, easing, callback){
|
||||
var anim = dojo.lfx.html.fadeOut(nodes, duration, easing, function(){
|
||||
if(dojo.lang.isArrayLike(nodes)){
|
||||
dojo.lang.forEach(nodes, dojo.style.hide);
|
||||
}else{
|
||||
dojo.style.hide(nodes);
|
||||
}
|
||||
if(callback){ callback(nodes, anim); }
|
||||
});
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html.wipeIn = function(nodes, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anims = [];
|
||||
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
var overflow = dojo.style.getStyle(node, "overflow");
|
||||
if(overflow == "visible") {
|
||||
node.style.overflow = "hidden";
|
||||
}
|
||||
node.style.height = "0px";
|
||||
dojo.style.show(node);
|
||||
|
||||
var anim = dojo.lfx.propertyAnimation(node,
|
||||
[{ property: "height",
|
||||
start: 0,
|
||||
end: node.scrollHeight }], duration, easing);
|
||||
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){
|
||||
oldOnEnd();
|
||||
node.style.overflow = overflow;
|
||||
node.style.height = "auto";
|
||||
if(callback){ callback(node, anim); }
|
||||
};
|
||||
anims.push(anim);
|
||||
});
|
||||
|
||||
if(nodes.length > 1){ return dojo.lfx.combine(anims); }
|
||||
else{ return anims[0]; }
|
||||
}
|
||||
|
||||
dojo.lfx.html.wipeOut = function(nodes, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anims = [];
|
||||
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
var overflow = dojo.style.getStyle(node, "overflow");
|
||||
if(overflow == "visible") {
|
||||
node.style.overflow = "hidden";
|
||||
}
|
||||
dojo.style.show(node);
|
||||
|
||||
var anim = dojo.lfx.propertyAnimation(node,
|
||||
[{ property: "height",
|
||||
start: dojo.style.getContentBoxHeight(node),
|
||||
end: 0 } ], duration, easing);
|
||||
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){
|
||||
oldOnEnd();
|
||||
dojo.style.hide(node);
|
||||
node.style.overflow = overflow;
|
||||
if(callback){ callback(node, anim); }
|
||||
};
|
||||
anims.push(anim);
|
||||
});
|
||||
|
||||
if(nodes.length > 1){ return dojo.lfx.combine(anims); }
|
||||
else { return anims[0]; }
|
||||
}
|
||||
|
||||
dojo.lfx.html.slideTo = function(nodes, coords, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anims = [];
|
||||
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
var top = null;
|
||||
var left = null;
|
||||
|
||||
var init = (function(){
|
||||
var innerNode = node;
|
||||
return function(){
|
||||
top = innerNode.offsetTop;
|
||||
left = innerNode.offsetLeft;
|
||||
|
||||
if (!dojo.style.isPositionAbsolute(innerNode)) {
|
||||
var ret = dojo.style.abs(innerNode, true);
|
||||
dojo.style.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;");
|
||||
top = ret.y;
|
||||
left = ret.x;
|
||||
}
|
||||
}
|
||||
})();
|
||||
init();
|
||||
|
||||
var anim = dojo.lfx.propertyAnimation(node,
|
||||
[{ property: "top",
|
||||
start: top,
|
||||
end: coords[0] },
|
||||
{ property: "left",
|
||||
start: left,
|
||||
end: coords[1] }], duration, easing);
|
||||
|
||||
var oldBb = (anim["beforeBegin"]) ? dojo.lang.hitch(anim, "beforeBegin") : function(){};
|
||||
anim.beforeBegin = function(){ oldBb(); init(); };
|
||||
|
||||
if(callback){
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){ oldOnEnd(); callback(nodes, anim); };
|
||||
}
|
||||
|
||||
anims.push(anim);
|
||||
});
|
||||
|
||||
if(nodes.length > 1){ return dojo.lfx.combine(anims); }
|
||||
else{ return anims[0]; }
|
||||
}
|
||||
|
||||
dojo.lfx.html.slideBy = function(nodes, coords, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anims = [];
|
||||
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
var top = null;
|
||||
var left = null;
|
||||
|
||||
var init = (function(){
|
||||
var innerNode = node;
|
||||
return function(){
|
||||
top = node.offsetTop;
|
||||
left = node.offsetLeft;
|
||||
|
||||
if (!dojo.style.isPositionAbsolute(innerNode)) {
|
||||
var ret = dojo.style.abs(innerNode);
|
||||
dojo.style.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;");
|
||||
top = ret.y;
|
||||
left = ret.x;
|
||||
}
|
||||
}
|
||||
})();
|
||||
init();
|
||||
|
||||
var anim = dojo.lfx.propertyAnimation(node,
|
||||
[{ property: "top",
|
||||
start: top,
|
||||
end: top+coords[0] },
|
||||
{ property: "left",
|
||||
start: left,
|
||||
end: left+coords[1] }], duration, easing);
|
||||
|
||||
var oldBb = (anim["beforeBegin"]) ? dojo.lang.hitch(anim, "beforeBegin") : function(){};
|
||||
anim.beforeBegin = function(){ oldBb(); init(); };
|
||||
|
||||
if(callback){
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){ oldOnEnd(); callback(nodes, anim); };
|
||||
}
|
||||
|
||||
anims.push(anim);
|
||||
});
|
||||
|
||||
if(nodes.length > 1){ return dojo.lfx.combine(anims); }
|
||||
else{ return anims[0]; }
|
||||
}
|
||||
|
||||
dojo.lfx.html.explode = function(start, endNode, duration, easing, callback){
|
||||
start = dojo.byId(start);
|
||||
endNode = dojo.byId(endNode);
|
||||
var startCoords = dojo.style.toCoordinateArray(start, true);
|
||||
var outline = document.createElement("div");
|
||||
dojo.html.copyStyle(outline, endNode);
|
||||
with(outline.style){
|
||||
position = "absolute";
|
||||
display = "none";
|
||||
}
|
||||
document.body.appendChild(outline);
|
||||
|
||||
with(endNode.style){
|
||||
visibility = "hidden";
|
||||
display = "block";
|
||||
}
|
||||
var endCoords = dojo.style.toCoordinateArray(endNode, true);
|
||||
with(endNode.style){
|
||||
display = "none";
|
||||
visibility = "visible";
|
||||
}
|
||||
|
||||
var anim = new dojo.lfx.propertyAnimation(outline, [
|
||||
{ property: "height", start: startCoords[3], end: endCoords[3] },
|
||||
{ property: "width", start: startCoords[2], end: endCoords[2] },
|
||||
{ property: "top", start: startCoords[1], end: endCoords[1] },
|
||||
{ property: "left", start: startCoords[0], end: endCoords[0] },
|
||||
{ property: "opacity", start: 0.3, end: 1.0 }
|
||||
], duration, easing);
|
||||
|
||||
anim.beforeBegin = function(){
|
||||
dojo.style.setDisplay(outline, "block");
|
||||
};
|
||||
anim.onEnd = function(){
|
||||
dojo.style.setDisplay(endNode, "block");
|
||||
outline.parentNode.removeChild(outline);
|
||||
};
|
||||
if(callback){
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){ oldOnEnd(); callback(endNode, anim); };
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html.implode = function(startNode, end, duration, easing, callback){
|
||||
startNode = dojo.byId(startNode);
|
||||
end = dojo.byId(end);
|
||||
var startCoords = dojo.style.toCoordinateArray(startNode, true);
|
||||
var endCoords = dojo.style.toCoordinateArray(end, true);
|
||||
|
||||
var outline = document.createElement("div");
|
||||
dojo.html.copyStyle(outline, startNode);
|
||||
dojo.style.setOpacity(outline, 0.3);
|
||||
with(outline.style){
|
||||
position = "absolute";
|
||||
display = "none";
|
||||
}
|
||||
document.body.appendChild(outline);
|
||||
|
||||
var anim = new dojo.lfx.propertyAnimation(outline, [
|
||||
{ property: "height", start: startCoords[3], end: endCoords[3] },
|
||||
{ property: "width", start: startCoords[2], end: endCoords[2] },
|
||||
{ property: "top", start: startCoords[1], end: endCoords[1] },
|
||||
{ property: "left", start: startCoords[0], end: endCoords[0] },
|
||||
{ property: "opacity", start: 1.0, end: 0.3 }
|
||||
], duration, easing);
|
||||
|
||||
anim.beforeBegin = function(){
|
||||
dojo.style.hide(startNode);
|
||||
dojo.style.show(outline);
|
||||
};
|
||||
anim.onEnd = function(){
|
||||
outline.parentNode.removeChild(outline);
|
||||
};
|
||||
if(callback){
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){ oldOnEnd(); callback(startNode, anim); };
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
|
||||
dojo.lfx.html.highlight = function(nodes, startColor, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anims = [];
|
||||
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
var color = dojo.style.getBackgroundColor(node);
|
||||
var bg = dojo.style.getStyle(node, "background-color").toLowerCase();
|
||||
var bgImage = dojo.style.getStyle(node, "background-image");
|
||||
var wasTransparent = (bg == "transparent" || bg == "rgba(0, 0, 0, 0)");
|
||||
while(color.length > 3) { color.pop(); }
|
||||
|
||||
var rgb = new dojo.graphics.color.Color(startColor);
|
||||
var endRgb = new dojo.graphics.color.Color(color);
|
||||
|
||||
var anim = dojo.lfx.propertyAnimation(node, [{
|
||||
property: "background-color",
|
||||
start: rgb,
|
||||
end: endRgb
|
||||
}], duration, easing);
|
||||
|
||||
var oldbb = (anim["beforeBegin"]) ? dojo.lang.hitch(anim, "beforeBegin") : function(){};
|
||||
anim.beforeBegin = function(){
|
||||
oldbb();
|
||||
if(bgImage){
|
||||
node.style.backgroundImage = "none";
|
||||
}
|
||||
node.style.backgroundColor = "rgb(" + rgb.toRgb().join(",") + ")";
|
||||
};
|
||||
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){
|
||||
oldOnEnd();
|
||||
if(bgImage){
|
||||
node.style.backgroundImage = bgImage;
|
||||
}
|
||||
if(wasTransparent){
|
||||
node.style.backgroundColor = "transparent";
|
||||
}
|
||||
if(callback){
|
||||
callback(node, anim);
|
||||
}
|
||||
};
|
||||
|
||||
anims.push(anim);
|
||||
});
|
||||
|
||||
if(nodes.length > 1){ return dojo.lfx.combine(anims); }
|
||||
else{ return anims[0]; }
|
||||
}
|
||||
|
||||
dojo.lfx.html.unhighlight = function(nodes, endColor, duration, easing, callback){
|
||||
nodes = dojo.lfx.html._byId(nodes);
|
||||
var anims = [];
|
||||
|
||||
dojo.lang.forEach(nodes, function(node){
|
||||
var color = new dojo.graphics.color.Color(dojo.style.getBackgroundColor(node));
|
||||
var rgb = new dojo.graphics.color.Color(endColor);
|
||||
|
||||
var bgImage = dojo.style.getStyle(node, "background-image");
|
||||
|
||||
var anim = dojo.lfx.propertyAnimation(node, [{
|
||||
property: "background-color",
|
||||
start: color,
|
||||
end: rgb
|
||||
}], duration, easing);
|
||||
|
||||
var oldbb = (anim["beforeBegin"]) ? dojo.lang.hitch(anim, "beforeBegin") : function(){};
|
||||
anim.beforeBegin = function(){
|
||||
oldbb();
|
||||
if(bgImage){
|
||||
node.style.backgroundImage = "none";
|
||||
}
|
||||
node.style.backgroundColor = "rgb(" + color.toRgb().join(",") + ")";
|
||||
};
|
||||
|
||||
var oldOnEnd = (anim["onEnd"]) ? dojo.lang.hitch(anim, "onEnd") : function(){};
|
||||
anim.onEnd = function(){
|
||||
oldOnEnd();
|
||||
if(callback){
|
||||
callback(node, anim);
|
||||
}
|
||||
};
|
||||
|
||||
anims.push(anim);
|
||||
});
|
||||
|
||||
if(nodes.length > 1){ return dojo.lfx.combine(anims); }
|
||||
else{ return anims[0]; }
|
||||
}
|
||||
|
||||
dojo.lang.mixin(dojo.lfx, dojo.lfx.html);
|
54
webapp/web/src/lfx/toggle.js
Normal file
54
webapp/web/src/lfx/toggle.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.lfx.toggle");
|
||||
dojo.require("dojo.lfx.*");
|
||||
|
||||
dojo.lfx.toggle.plain = {
|
||||
show: function(node, duration, easing, callback){
|
||||
dojo.style.show(node);
|
||||
if(dojo.lang.isFunction(callback)){ callback(); }
|
||||
},
|
||||
|
||||
hide: function(node, duration, easing, callback){
|
||||
dojo.style.hide(node);
|
||||
if(dojo.lang.isFunction(callback)){ callback(); }
|
||||
}
|
||||
}
|
||||
|
||||
dojo.lfx.toggle.fade = {
|
||||
show: function(node, duration, easing, callback){
|
||||
dojo.lfx.fadeShow(node, duration, easing, callback).play();
|
||||
},
|
||||
|
||||
hide: function(node, duration, easing, callback){
|
||||
dojo.lfx.fadeHide(node, duration, easing, callback).play();
|
||||
}
|
||||
}
|
||||
|
||||
dojo.lfx.toggle.wipe = {
|
||||
show: function(node, duration, easing, callback){
|
||||
dojo.lfx.wipeIn(node, duration, easing, callback).play();
|
||||
},
|
||||
|
||||
hide: function(node, duration, easing, callback){
|
||||
dojo.lfx.wipeOut(node, duration, easing, callback).play();
|
||||
}
|
||||
}
|
||||
|
||||
dojo.lfx.toggle.explode = {
|
||||
show: function(node, duration, easing, callback, explodeSrc){
|
||||
dojo.lfx.explode(explodeSrc||[0,0,0,0], node, duration, easing, callback).play();
|
||||
},
|
||||
|
||||
hide: function(node, duration, easing, callback, explodeSrc){
|
||||
dojo.lfx.implode(node, explodeSrc||[0,0,0,0], duration, easing, callback).play();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue