You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2006/06/27 22:39:57 UTC
svn commit: r417614 - in /incubator/xap/trunk/src/dojo/src: lang/ lfx/
logging/ math/ reflect/
Author: jmargaris
Date: Tue Jun 27 15:39:56 2006
New Revision: 417614
URL: http://svn.apache.org/viewvc?rev=417614&view=rev
Log:
dojo 0.3
Added:
incubator/xap/trunk/src/dojo/src/lang/
incubator/xap/trunk/src/dojo/src/lang/Lang.js (with props)
incubator/xap/trunk/src/dojo/src/lang/__package__.js (with props)
incubator/xap/trunk/src/dojo/src/lang/array.js (with props)
incubator/xap/trunk/src/dojo/src/lang/assert.js (with props)
incubator/xap/trunk/src/dojo/src/lang/common.js (with props)
incubator/xap/trunk/src/dojo/src/lang/declare.js (with props)
incubator/xap/trunk/src/dojo/src/lang/extras.js (with props)
incubator/xap/trunk/src/dojo/src/lang/func.js (with props)
incubator/xap/trunk/src/dojo/src/lang/repr.js (with props)
incubator/xap/trunk/src/dojo/src/lang/type.js (with props)
incubator/xap/trunk/src/dojo/src/lfx/
incubator/xap/trunk/src/dojo/src/lfx/Animation.js
incubator/xap/trunk/src/dojo/src/lfx/__package__.js (with props)
incubator/xap/trunk/src/dojo/src/lfx/extras.js
incubator/xap/trunk/src/dojo/src/lfx/toggle.js
incubator/xap/trunk/src/dojo/src/logging/
incubator/xap/trunk/src/dojo/src/logging/__package__.js (with props)
incubator/xap/trunk/src/dojo/src/math/
incubator/xap/trunk/src/dojo/src/math/Math.js (with props)
incubator/xap/trunk/src/dojo/src/math/__package__.js (with props)
incubator/xap/trunk/src/dojo/src/math/curves.js (with props)
incubator/xap/trunk/src/dojo/src/math/matrix.js (with props)
incubator/xap/trunk/src/dojo/src/math/points.js (with props)
incubator/xap/trunk/src/dojo/src/reflect/
incubator/xap/trunk/src/dojo/src/reflect/__package__.js (with props)
incubator/xap/trunk/src/dojo/src/reflect/reflection.js (with props)
Added: incubator/xap/trunk/src/dojo/src/lang/Lang.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/Lang.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/Lang.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/Lang.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,12 @@
+/*
+ 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.require("dojo.lang");
+dojo.deprecated("dojo.lang.Lang is deprecated, use dojo.lang instead");
Propchange: incubator/xap/trunk/src/dojo/src/lang/Lang.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/__package__.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/__package__.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/__package__.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/__package__.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,24 @@
+/*
+ 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({
+ common: [
+ "dojo.lang",
+ "dojo.lang.common",
+ "dojo.lang.assert",
+ "dojo.lang.array",
+ "dojo.lang.type",
+ "dojo.lang.func",
+ "dojo.lang.extras",
+ "dojo.lang.repr",
+ "dojo.lang.declare"
+ ]
+});
+dojo.provide("dojo.lang.*");
Propchange: incubator/xap/trunk/src/dojo/src/lang/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/array.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/array.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/array.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/array.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,172 @@
+/*
+ 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.lang.array");
+
+dojo.require("dojo.lang.common");
+
+// FIXME: Is this worthless since you can do: if(name in obj)
+// is this the right place for this?
+dojo.lang.has = function(obj, name){
+ try{
+ return (typeof obj[name] != "undefined");
+ }catch(e){ return false; }
+}
+
+dojo.lang.isEmpty = function(obj) {
+ if(dojo.lang.isObject(obj)) {
+ var tmp = {};
+ var count = 0;
+ for(var x in obj){
+ if(obj[x] && (!tmp[x])){
+ count++;
+ break;
+ }
+ }
+ return (count == 0);
+ } else if(dojo.lang.isArrayLike(obj) || dojo.lang.isString(obj)) {
+ return obj.length == 0;
+ }
+}
+
+dojo.lang.map = function(arr, obj, unary_func){
+ var isString = dojo.lang.isString(arr);
+ if(isString){
+ arr = arr.split("");
+ }
+ if(dojo.lang.isFunction(obj)&&(!unary_func)){
+ unary_func = obj;
+ obj = dj_global;
+ }else if(dojo.lang.isFunction(obj) && unary_func){
+ // ff 1.5 compat
+ var tmpObj = obj;
+ obj = unary_func;
+ unary_func = tmpObj;
+ }
+ if(Array.map){
+ var outArr = Array.map(arr, unary_func, obj);
+ }else{
+ var outArr = [];
+ for(var i=0;i<arr.length;++i){
+ outArr.push(unary_func.call(obj, arr[i]));
+ }
+ }
+ if(isString) {
+ return outArr.join("");
+ } else {
+ return outArr;
+ }
+}
+
+// http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:forEach
+dojo.lang.forEach = function(anArray /* Array */, callback /* Function */, thisObject /* Object */){
+ if(dojo.lang.isString(anArray)){
+ anArray = anArray.split("");
+ }
+ if(Array.forEach){
+ Array.forEach(anArray, callback, thisObject);
+ }else{
+ // FIXME: there are several ways of handilng thisObject. Is dj_global always the default context?
+ if(!thisObject){
+ thisObject=dj_global;
+ }
+ for(var i=0,l=anArray.length; i<l; i++){
+ callback.call(thisObject, anArray[i], i, anArray);
+ }
+ }
+}
+
+dojo.lang._everyOrSome = function(every, arr, callback, thisObject){
+ if(dojo.lang.isString(arr)){
+ arr = arr.split("");
+ }
+ if(Array.every){
+ return Array[ (every) ? "every" : "some" ](arr, callback, thisObject);
+ }else{
+ if(!thisObject){
+ thisObject = dj_global;
+ }
+ for(var i=0,l=arr.length; i<l; i++){
+ var result = callback.call(thisObject, arr[i], i, arr);
+ if((every)&&(!result)){
+ return false;
+ }else if((!every)&&(result)){
+ return true;
+ }
+ }
+ return (every) ? true : false;
+ }
+}
+
+dojo.lang.every = function(arr, callback, thisObject){
+ return this._everyOrSome(true, arr, callback, thisObject);
+}
+
+dojo.lang.some = function(arr, callback, thisObject){
+ return this._everyOrSome(false, arr, callback, thisObject);
+}
+
+dojo.lang.filter = function(arr, callback, thisObject) {
+ var isString = dojo.lang.isString(arr);
+ if(isString) { arr = arr.split(""); }
+ if(Array.filter) {
+ var outArr = Array.filter(arr, callback, thisObject);
+ } else {
+ if(!thisObject) {
+ if(arguments.length >= 3) { dojo.raise("thisObject doesn't exist!"); }
+ thisObject = dj_global;
+ }
+
+ var outArr = [];
+ for(var i = 0; i < arr.length; i++) {
+ if(callback.call(thisObject, arr[i], i, arr)) {
+ outArr.push(arr[i]);
+ }
+ }
+ }
+ if(isString) {
+ return outArr.join("");
+ } else {
+ return outArr;
+ }
+}
+
+/**
+ * Creates a 1-D array out of all the arguments passed,
+ * unravelling any array-like objects in the process
+ *
+ * Ex:
+ * unnest(1, 2, 3) ==> [1, 2, 3]
+ * unnest(1, [2, [3], [[[4]]]]) ==> [1, 2, 3, 4]
+ */
+dojo.lang.unnest = function(/* ... */) {
+ var out = [];
+ for(var i = 0; i < arguments.length; i++) {
+ if(dojo.lang.isArrayLike(arguments[i])) {
+ var add = dojo.lang.unnest.apply(this, arguments[i]);
+ out = out.concat(add);
+ } else {
+ out.push(arguments[i]);
+ }
+ }
+ return out;
+}
+
+/**
+ * Converts an array-like object (i.e. arguments, DOMCollection)
+ * to an array
+**/
+dojo.lang.toArray = function(arrayLike, startOffset) {
+ var array = [];
+ for(var i = startOffset||0; i < arrayLike.length; i++) {
+ array.push(arrayLike[i]);
+ }
+ return array;
+}
Propchange: incubator/xap/trunk/src/dojo/src/lang/array.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/assert.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/assert.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/assert.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/assert.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,121 @@
+/*
+ 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.lang.assert");
+
+dojo.require("dojo.lang.common");
+dojo.require("dojo.lang.array");
+dojo.require("dojo.lang.type");
+
+// -------------------------------------------------------------------
+// Assertion methods
+// -------------------------------------------------------------------
+
+/**
+ * Throws an exception if the assertion fails.
+ *
+ * If the asserted condition is true, this method does nothing. If the
+ * condition is false, we throw an error with a error message.
+ *
+ * @param booleanValue A boolean value, which needs to be true for the assertion to succeed.
+ * @param message Optional. A string describing the assertion.
+ * @throws Throws an Error if 'booleanValue' is false.
+ */
+dojo.lang.assert = function(booleanValue, message){
+ if(!booleanValue){
+ var errorMessage = "An assert statement failed.\n" +
+ "The method dojo.lang.assert() was called with a 'false' value.\n";
+ if(message){
+ errorMessage += "Here's the assert message:\n" + message + "\n";
+ }
+ // Use throw instead of dojo.raise, until bug #264 is fixed:
+ // dojo.raise(errorMessage);
+ throw new Error(errorMessage);
+ }
+}
+
+/**
+ * Given a value and a data type, this method checks the type of the value
+ * to make sure it matches the data type, and throws an exception if there
+ * is a mismatch.
+ *
+ * Examples:
+ * <pre>
+ * dojo.lang.assertType("foo", String);
+ * dojo.lang.assertType(12345, Number);
+ * dojo.lang.assertType(false, Boolean);
+ * dojo.lang.assertType([6, 8], Array);
+ * dojo.lang.assertType(dojo.lang.assertType, Function);
+ * dojo.lang.assertType({foo: "bar"}, Object);
+ * dojo.lang.assertType(new Date(), Date);
+ * </pre>
+ *
+ * @scope public function
+ * @param value Any literal value or object instance.
+ * @param type A class of object, or a literal type, or the string name of a type, or an array with a list of types.
+ * @param message Optional. A string describing the assertion.
+ * @throws Throws an Error if 'value' is not of type 'type'.
+ */
+dojo.lang.assertType = function(value, type, message){
+ if(!dojo.lang.isOfType(value, type)){
+ if(!message){
+ if(!dojo.lang.assertType._errorMessage){
+ dojo.lang.assertType._errorMessage = "Type mismatch: dojo.lang.assertType() failed.";
+ }
+ message = dojo.lang.assertType._errorMessage;
+ }
+ dojo.lang.assert(false, message);
+ }
+}
+
+/**
+ * Given an anonymous object and a list of expected property names, this
+ * method check to make sure the object does not have any properties
+ * that aren't on the list of expected properties, and throws an Error
+ * if there are unexpected properties. This is useful for doing error
+ * checking on keyword arguments, to make sure there aren't typos.
+ *
+ * Examples:
+ * <pre>
+ * dojo.lang.assertValidKeywords({a: 1, b: 2}, ["a", "b"]);
+ * dojo.lang.assertValidKeywords({a: 1, b: 2}, ["a", "b", "c"]);
+ * dojo.lang.assertValidKeywords({foo: "iggy"}, ["foo"]);
+ * dojo.lang.assertValidKeywords({foo: "iggy"}, ["foo", "bar"]);
+ * dojo.lang.assertValidKeywords({foo: "iggy"}, {foo: null, bar: null});
+ * </pre>
+ *
+ * @scope public function
+ * @param object An anonymous object.
+ * @param expectedProperties An array of strings (or an object with all the expected properties).
+ * @param message Optional. A string describing the assertion.
+ * @throws Throws an Error if 'value' is not of type 'type'.
+ */
+dojo.lang.assertValidKeywords = function(object, expectedProperties, message){
+ var key;
+ if(!message){
+ if(!dojo.lang.assertValidKeywords._errorMessage){
+ dojo.lang.assertValidKeywords._errorMessage = "In dojo.lang.assertValidKeywords(), found invalid keyword:";
+ }
+ message = dojo.lang.assertValidKeywords._errorMessage;
+ }
+ if(dojo.lang.isArray(expectedProperties)){
+ for(key in object){
+ if(!dojo.lang.inArray(expectedProperties, key)){
+ dojo.lang.assert(false, message + " " + key);
+ }
+ }
+ }else{
+ for(key in object){
+ if(!(key in expectedProperties)){
+ dojo.lang.assert(false, message + " " + key);
+ }
+ }
+ }
+}
Propchange: incubator/xap/trunk/src/dojo/src/lang/assert.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/common.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/common.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/common.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/common.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,175 @@
+/*
+ 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.lang.common");
+
+dojo.require("dojo.lang");
+
+/*
+ * Adds the given properties/methods to the specified object
+ */
+dojo.lang.mixin = function(obj, props){
+ var tobj = {};
+ for(var x in props){
+ // the "tobj" condition avoid copying properties in "props"
+ // inherited from Object.prototype. For example, if obj has a custom
+ // toString() method, don't overwrite it with the toString() method
+ // that props inherited from Object.protoype
+ if(typeof tobj[x] == "undefined" || tobj[x] != props[x]) {
+ obj[x] = props[x];
+ }
+ }
+ // IE doesn't recognize custom toStrings in for..in
+ if(dojo.render.html.ie && dojo.lang.isFunction(props["toString"]) && props["toString"] != obj["toString"]) {
+ obj.toString = props.toString;
+ }
+ return obj;
+}
+
+/*
+ * Adds the given properties/methods to the specified object's prototype
+ */
+dojo.lang.extend = function(ctor, props){
+ this.mixin(ctor.prototype, props);
+}
+
+/**
+ * See if val is in arr. Call signatures:
+ * find(array, value, identity) // recommended
+ * find(value, array, identity)
+**/
+dojo.lang.find = function( /*Array*/ arr,
+ /*Object*/ val,
+ /*boolean*/ identity,
+ /*boolean*/ findLast){
+ // support both (arr, val) and (val, arr)
+ if(!dojo.lang.isArrayLike(arr) && dojo.lang.isArrayLike(val)) {
+ var a = arr;
+ arr = val;
+ val = a;
+ }
+ var isString = dojo.lang.isString(arr);
+ if(isString) { arr = arr.split(""); }
+
+ if(findLast) {
+ var step = -1;
+ var i = arr.length - 1;
+ var end = -1;
+ } else {
+ var step = 1;
+ var i = 0;
+ var end = arr.length;
+ }
+ if(identity){
+ while(i != end) {
+ if(arr[i] === val){ return i; }
+ i += step;
+ }
+ }else{
+ while(i != end) {
+ if(arr[i] == val){ return i; }
+ i += step;
+ }
+ }
+ return -1;
+}
+
+dojo.lang.indexOf = dojo.lang.find;
+
+dojo.lang.findLast = function(/*Array*/ arr, /*Object*/ val, /*boolean*/ identity){
+ return dojo.lang.find(arr, val, identity, true);
+}
+
+dojo.lang.lastIndexOf = dojo.lang.findLast;
+
+dojo.lang.inArray = function(arr /*Array*/, val /*Object*/){
+ return dojo.lang.find(arr, val) > -1; // return: boolean
+}
+
+/**
+ * Partial implmentation of is* functions from
+ * http://www.crockford.com/javascript/recommend.html
+ * NOTE: some of these may not be the best thing to use in all situations
+ * as they aren't part of core JS and therefore can't work in every case.
+ * See WARNING messages inline for tips.
+ *
+ * The following is* functions are fairly "safe"
+ */
+
+dojo.lang.isObject = function(wh) {
+ return typeof wh == "object" || dojo.lang.isArray(wh) || dojo.lang.isFunction(wh);
+}
+
+dojo.lang.isArray = function(wh) {
+ return (wh instanceof Array || typeof wh == "array");
+}
+
+dojo.lang.isArrayLike = function(wh) {
+ if(dojo.lang.isString(wh)){ return false; }
+ if(dojo.lang.isFunction(wh)){ return false; } // keeps out built-in ctors (Number, String, ...) which have length properties
+ if(dojo.lang.isArray(wh)){ return true; }
+ if(typeof wh != "undefined" && wh
+ && dojo.lang.isNumber(wh.length) && isFinite(wh.length)){ return true; }
+ return false;
+}
+
+dojo.lang.isFunction = function(wh) {
+ return (wh instanceof Function || typeof wh == "function");
+}
+
+dojo.lang.isString = function(wh) {
+ return (wh instanceof String || typeof wh == "string");
+}
+
+dojo.lang.isAlien = function(wh) {
+ return !dojo.lang.isFunction() && /\{\s*\[native code\]\s*\}/.test(String(wh));
+}
+
+dojo.lang.isBoolean = function(wh) {
+ return (wh instanceof Boolean || typeof wh == "boolean");
+}
+
+/**
+ * The following is***() functions are somewhat "unsafe". Fortunately,
+ * there are workarounds the the language provides and are mentioned
+ * in the WARNING messages.
+ *
+ * WARNING: In most cases, isNaN(wh) is sufficient to determine whether or not
+ * something is a number or can be used as such. For example, a number or string
+ * can be used interchangably when accessing array items (arr["1"] is the same as
+ * arr[1]) and isNaN will return false for both values ("1" and 1). Should you
+ * use isNumber("1"), that will return false, which is generally not too useful.
+ * Also, isNumber(NaN) returns true, again, this isn't generally useful, but there
+ * are corner cases (like when you want to make sure that two things are really
+ * the same type of thing). That is really where isNumber "shines".
+ *
+ * RECOMMENDATION: Use isNaN(wh) when possible
+ */
+dojo.lang.isNumber = function(wh) {
+ return (wh instanceof Number || typeof wh == "number");
+}
+
+/**
+ * WARNING: In some cases, isUndefined will not behave as you
+ * might expect. If you do isUndefined(foo) and there is no earlier
+ * reference to foo, an error will be thrown before isUndefined is
+ * called. It behaves correctly if you scope yor object first, i.e.
+ * isUndefined(foo.bar) where foo is an object and bar isn't a
+ * property of the object.
+ *
+ * RECOMMENDATION: Use `typeof foo == "undefined"` when possible
+ *
+ * FIXME: Should isUndefined go away since it is error prone?
+ */
+dojo.lang.isUndefined = function(wh) {
+ return ((wh == undefined)&&(typeof wh == "undefined"));
+}
+
+// end Crockford functions
Propchange: incubator/xap/trunk/src/dojo/src/lang/common.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/declare.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/declare.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/declare.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/declare.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,101 @@
+/*
+ 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.lang.declare");
+
+dojo.require("dojo.lang.common");
+dojo.require("dojo.lang.extras");
+
+/*
+ * Creates a constructor: inherit and extend
+ *
+ * - inherits from "superclass" (via dojo.inherits, null is ok)
+ * - "props" are mixed-in to the prototype (via dojo.lang.extend)
+ * - can have an initializer function that fires when the class is created.
+ * - name of the class ("className" argument) is stored in "clasName" property
+ *
+ * The initializer function works just like a constructor, except it has the following benefits:
+ * - it doesn't fire at inheritance time (when prototyping)
+ * - properties set in the initializer do not become part of subclass prototypes
+ *
+ * The initializer can be specified in the "init" argument, or by including a function called
+ * "initializer" in "props".
+ *
+ * Superclass methods (inherited methods) can be invoked using "inherited" method:
+ * this.inherited(<method name>[, <argument array>]);
+ * - inherited will continue up the prototype chain until it finds an implementation of method
+ * - nested calls to inherited are supported (i.e. inherited method "A" can succesfully call inherited("A"), and so on)
+ *
+ * Aliased as "dojo.declare"
+ *
+ * Usage:
+ *
+ * dojo.declare("my.classes.bar", my.classes.foo, {
+ * initializer: function() {
+ * this.myComplicatedObject = new ReallyComplicatedObject();
+ * },
+ * someValue: 2,
+ * aMethod: function() { doStuff(); }
+ * });
+ *
+ */
+dojo.lang.declare = function(className /*string*/, superclass /*function*/ , props /*object*/, init /*function*/){
+ var ctor = function(){
+ // get the generational context (which object [or prototype] should be constructed)
+ var self = this._getPropContext();
+ var s = self.constructor.superclass;
+ if((s)&&(s.constructor)){
+ // if this constructor is invoked directly by some constructor (my.ancestor.call(this))
+ if(s.constructor==arguments.callee){
+ this.inherited("constructor", arguments);
+ }else{
+ this._inherited(s, "constructor", arguments);
+ }
+ }
+ if((!this.prototyping)&&(self.initializer)){
+ self.initializer.apply(this, arguments);
+ }
+ }
+ var scp = (superclass ? superclass.prototype : null);
+ if(scp){
+ scp.prototyping = true;
+ ctor.prototype = new superclass();
+ scp.prototyping = false;
+ }
+ ctor.prototype.constructor = ctor;
+ ctor.superclass = scp;
+ dojo.lang.extend(ctor, dojo.lang.declare.base);
+ props=(props||{});
+ props.initializer = (props.initializer)||(init)||(function(){ });
+ props.className = className;
+ dojo.lang.extend(ctor, props);
+ dojo.lang.setObjPathValue(className, ctor, null, true);
+}
+dojo.lang.declare.base = {
+ _getPropContext: function() { return (this.___proto||this); },
+ // cache ptype context and call method on it
+ _inherited: function(ptype, method, args){
+ var stack = this.___proto;
+ this.___proto = ptype;
+ var result = ptype[method].apply(this, (args||[]));
+ this.___proto = stack;
+ return result;
+ },
+ // searches backward thru prototype chain to find nearest ancestral iplementation of method
+ inherited: function(prop, args){
+ var p = this._getPropContext();
+ do{
+ if((!p.constructor)||(!p.constructor.superclass)){return;}
+ p = p.constructor.superclass;
+ }while(!(prop in p));
+ return (typeof p[prop] == 'function' ? this._inherited(p, prop, args) : p[prop]);
+ }
+}
+dojo.declare = dojo.lang.declare;
Propchange: incubator/xap/trunk/src/dojo/src/lang/declare.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/extras.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/extras.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/extras.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/extras.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,108 @@
+/*
+ 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.lang.extras");
+
+dojo.require("dojo.lang.common");
+
+/**
+ * Sets a timeout in milliseconds to execute a function in a given context
+ * with optional arguments.
+ *
+ * setTimeout (Object context, function func, number delay[, arg1[, ...]]);
+ * setTimeout (function func, number delay[, arg1[, ...]]);
+ */
+dojo.lang.setTimeout = function(func, delay){
+ var context = window, argsStart = 2;
+ if(!dojo.lang.isFunction(func)){
+ context = func;
+ func = delay;
+ delay = arguments[2];
+ argsStart++;
+ }
+
+ if(dojo.lang.isString(func)){
+ func = context[func];
+ }
+
+ var args = [];
+ for (var i = argsStart; i < arguments.length; i++) {
+ args.push(arguments[i]);
+ }
+ return setTimeout(function () { func.apply(context, args); }, delay);
+}
+
+dojo.lang.getNameInObj = function(ns, item){
+ if(!ns){ ns = dj_global; }
+
+ for(var x in ns){
+ if(ns[x] === item){
+ return new String(x);
+ }
+ }
+ return null;
+}
+
+dojo.lang.shallowCopy = function(obj) {
+ var ret = {}, key;
+ for(key in obj) {
+ if(dojo.lang.isUndefined(ret[key])) {
+ ret[key] = obj[key];
+ }
+ }
+ return ret;
+}
+
+/**
+ * Return the first argument that isn't undefined
+ */
+dojo.lang.firstValued = function(/* ... */) {
+ for(var i = 0; i < arguments.length; i++) {
+ if(typeof arguments[i] != "undefined") {
+ return arguments[i];
+ }
+ }
+ return undefined;
+}
+
+/**
+ * Get a value from a reference specified as a string descriptor,
+ * (e.g. "A.B") in the given context.
+ *
+ * getObjPathValue(String objpath [, Object context, Boolean create])
+ *
+ * If context is not specified, dj_global is used
+ * If create is true, undefined objects in the path are created.
+ */
+dojo.lang.getObjPathValue = function(objpath, context, create){
+ with(dojo.parseObjPath(objpath, context, create)){
+ return dojo.evalProp(prop, obj, create);
+ }
+}
+
+/**
+ * Set a value on a reference specified as a string descriptor.
+ * (e.g. "A.B") in the given context.
+ *
+ * setObjPathValue(String objpath, value [, Object context, Boolean create])
+ *
+ * If context is not specified, dj_global is used
+ * If create is true, undefined objects in the path are created.
+ */
+dojo.lang.setObjPathValue = function(objpath, value, context, create){
+ if(arguments.length < 4){
+ create = true;
+ }
+ with(dojo.parseObjPath(objpath, context, create)){
+ if(obj && (create || (prop in obj))){
+ obj[prop] = value;
+ }
+ }
+}
Propchange: incubator/xap/trunk/src/dojo/src/lang/extras.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/func.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/func.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/func.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/func.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,149 @@
+/*
+ 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.lang.func");
+
+dojo.require("dojo.lang.common");
+
+/**
+ * Runs a function in a given scope (thisObject), can
+ * also be used to preserve scope.
+ *
+ * hitch(foo, "bar"); // runs foo.bar() in the scope of foo
+ * hitch(foo, myFunction); // runs myFunction in the scope of foo
+ */
+dojo.lang.hitch = function(thisObject, method) {
+ if(dojo.lang.isString(method)) {
+ var fcn = thisObject[method];
+ } else {
+ var fcn = method;
+ }
+
+ return function() {
+ return fcn.apply(thisObject, arguments);
+ }
+}
+
+dojo.lang.anonCtr = 0;
+dojo.lang.anon = {};
+dojo.lang.nameAnonFunc = function(anonFuncPtr, namespaceObj){
+ var nso = (namespaceObj || dojo.lang.anon);
+ if((dj_global["djConfig"])&&(djConfig["slowAnonFuncLookups"] == true)){
+ for(var x in nso){
+ if(nso[x] === anonFuncPtr){
+ return x;
+ }
+ }
+ }
+ var ret = "__"+dojo.lang.anonCtr++;
+ while(typeof nso[ret] != "undefined"){
+ ret = "__"+dojo.lang.anonCtr++;
+ }
+ nso[ret] = anonFuncPtr;
+ return ret;
+}
+
+dojo.lang.forward = function(funcName){
+ // Returns a function that forwards a method call to this.func(...)
+ return function(){
+ return this[funcName].apply(this, arguments);
+ };
+}
+
+dojo.lang.curry = function(ns, func /* args ... */){
+ var outerArgs = [];
+ ns = ns||dj_global;
+ if(dojo.lang.isString(func)){
+ func = ns[func];
+ }
+ for(var x=2; x<arguments.length; x++){
+ outerArgs.push(arguments[x]);
+ }
+ // since the event system replaces the original function with a new
+ // join-point runner with an arity of 0, we check to see if it's left us
+ // any clues about the original arity in lieu of the function's actual
+ // length property
+ var ecount = (func["__preJoinArity"]||func.length) - outerArgs.length;
+ // borrowed from svend tofte
+ function gather(nextArgs, innerArgs, expected){
+ var texpected = expected;
+ var totalArgs = innerArgs.slice(0); // copy
+ for(var x=0; x<nextArgs.length; x++){
+ totalArgs.push(nextArgs[x]);
+ }
+ // check the list of provided nextArgs to see if it, plus the
+ // number of innerArgs already supplied, meets the total
+ // expected.
+ expected = expected-nextArgs.length;
+ if(expected<=0){
+ var res = func.apply(ns, totalArgs);
+ expected = texpected;
+ return res;
+ }else{
+ return function(){
+ return gather(arguments,// check to see if we've been run
+ // with enough args
+ totalArgs, // a copy
+ expected); // how many more do we need to run?;
+ }
+ }
+ }
+ return gather([], outerArgs, ecount);
+}
+
+dojo.lang.curryArguments = function(ns, func, args, offset){
+ var targs = [];
+ var x = offset||0;
+ for(x=offset; x<args.length; x++){
+ targs.push(args[x]); // ensure that it's an arr
+ }
+ return dojo.lang.curry.apply(dojo.lang, [ns, func].concat(targs));
+}
+
+dojo.lang.tryThese = function(){
+ for(var x=0; x<arguments.length; x++){
+ try{
+ if(typeof arguments[x] == "function"){
+ var ret = (arguments[x]());
+ if(ret){
+ return ret;
+ }
+ }
+ }catch(e){
+ dojo.debug(e);
+ }
+ }
+}
+
+dojo.lang.delayThese = function(farr, cb, delay, onend){
+ /**
+ * alternate: (array funcArray, function callback, function onend)
+ * alternate: (array funcArray, function callback)
+ * alternate: (array funcArray)
+ */
+ if(!farr.length){
+ if(typeof onend == "function"){
+ onend();
+ }
+ return;
+ }
+ if((typeof delay == "undefined")&&(typeof cb == "number")){
+ delay = cb;
+ cb = function(){};
+ }else if(!cb){
+ cb = function(){};
+ if(!delay){ delay = 0; }
+ }
+ setTimeout(function(){
+ (farr.shift())();
+ cb();
+ dojo.lang.delayThese(farr, cb, delay, onend);
+ }, delay);
+}
Propchange: incubator/xap/trunk/src/dojo/src/lang/func.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/repr.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/repr.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/repr.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/repr.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,90 @@
+/*
+ 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.lang.repr");
+
+dojo.require("dojo.lang.common");
+dojo.require("dojo.AdapterRegistry");
+dojo.require("dojo.string.extras");
+
+dojo.lang.reprRegistry = new dojo.AdapterRegistry();
+dojo.lang.registerRepr = function(name, check, wrap, /*optional*/ override){
+ /***
+ Register a repr function. repr functions should take
+ one argument and return a string representation of it
+ suitable for developers, primarily used when debugging.
+
+ If override is given, it is used as the highest priority
+ repr, otherwise it will be used as the lowest.
+ ***/
+ dojo.lang.reprRegistry.register(name, check, wrap, override);
+ };
+
+dojo.lang.repr = function(obj){
+ /***
+ Return a "programmer representation" for an object
+ ***/
+ if(typeof(obj) == "undefined"){
+ return "undefined";
+ }else if(obj === null){
+ return "null";
+ }
+
+ try{
+ if(typeof(obj["__repr__"]) == 'function'){
+ return obj["__repr__"]();
+ }else if((typeof(obj["repr"]) == 'function')&&(obj.repr != arguments.callee)){
+ return obj["repr"]();
+ }
+ return dojo.lang.reprRegistry.match(obj);
+ }catch(e){
+ if(typeof(obj.NAME) == 'string' && (
+ obj.toString == Function.prototype.toString ||
+ obj.toString == Object.prototype.toString
+ )){
+ return o.NAME;
+ }
+ }
+
+ if(typeof(obj) == "function"){
+ obj = (obj + "").replace(/^\s+/, "");
+ var idx = obj.indexOf("{");
+ if(idx != -1){
+ obj = obj.substr(0, idx) + "{...}";
+ }
+ }
+ return obj + "";
+}
+
+dojo.lang.reprArrayLike = function(arr){
+ try{
+ var na = dojo.lang.map(arr, dojo.lang.repr);
+ return "[" + na.join(", ") + "]";
+ }catch(e){ }
+};
+
+dojo.lang.reprString = function(str){
+ dojo.deprecated("dojo.lang.reprNumber", "use `String(num)` instead", "0.4");
+ return dojo.string.escapeString(str);
+};
+
+dojo.lang.reprNumber = function(num){
+ dojo.deprecated("dojo.lang.reprNumber", "use `String(num)` instead", "0.4");
+ return num + "";
+};
+
+(function(){
+ var m = dojo.lang;
+ m.registerRepr("arrayLike", m.isArrayLike, m.reprArrayLike);
+ m.registerRepr("string", m.isString, m.reprString);
+ m.registerRepr("numbers", m.isNumber, m.reprNumber);
+ m.registerRepr("boolean", m.isBoolean, m.reprNumber);
+ // m.registerRepr("numbers", m.typeMatcher("number", "boolean"), m.reprNumber);
+})();
Propchange: incubator/xap/trunk/src/dojo/src/lang/repr.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lang/type.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lang/type.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lang/type.js (added)
+++ incubator/xap/trunk/src/dojo/src/lang/type.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,226 @@
+/*
+ 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.lang.type");
+
+dojo.require("dojo.lang.common");
+
+dojo.lang.whatAmI = function(wh) {
+ try {
+ if(dojo.lang.isArray(wh)) { return "array"; }
+ if(dojo.lang.isFunction(wh)) { return "function"; }
+ if(dojo.lang.isString(wh)) { return "string"; }
+ if(dojo.lang.isNumber(wh)) { return "number"; }
+ if(dojo.lang.isBoolean(wh)) { return "boolean"; }
+ if(dojo.lang.isAlien(wh)) { return "alien"; }
+ if(dojo.lang.isUndefined(wh)) { return "undefined"; }
+ // FIXME: should this go first?
+ for(var name in dojo.lang.whatAmI.custom) {
+ if(dojo.lang.whatAmI.custom[name](wh)) {
+ return name;
+ }
+ }
+ if(dojo.lang.isObject(wh)) { return "object"; }
+ } catch(E) {}
+ return "unknown";
+}
+/*
+ * dojo.lang.whatAmI.custom[typeName] = someFunction
+ * will return typeName is someFunction(wh) returns true
+ */
+dojo.lang.whatAmI.custom = {};
+
+/**
+ * Returns true for values that commonly represent numbers.
+ *
+ * Examples:
+ * <pre>
+ * dojo.lang.isNumeric(3); // returns true
+ * dojo.lang.isNumeric("3"); // returns true
+ * dojo.lang.isNumeric(new Number(3)); // returns true
+ * dojo.lang.isNumeric(new String("3")); // returns true
+ *
+ * dojo.lang.isNumeric(3/0); // returns false
+ * dojo.lang.isNumeric("foo"); // returns false
+ * dojo.lang.isNumeric(new Number("foo")); // returns false
+ * dojo.lang.isNumeric(false); // returns false
+ * dojo.lang.isNumeric(true); // returns false
+ * </pre>
+ */
+dojo.lang.isNumeric = function(wh){
+ return (!isNaN(wh) && isFinite(wh) && (wh != null) &&
+ !dojo.lang.isBoolean(wh) && !dojo.lang.isArray(wh));
+}
+
+/**
+ * Returns true for any literal, and for any object that is an
+ * instance of a built-in type like String, Number, Boolean,
+ * Array, Function, or Error.
+ */
+dojo.lang.isBuiltIn = function(wh){
+ return (dojo.lang.isArray(wh) ||
+ dojo.lang.isFunction(wh) ||
+ dojo.lang.isString(wh) ||
+ dojo.lang.isNumber(wh) ||
+ dojo.lang.isBoolean(wh) ||
+ (wh == null) ||
+ (wh instanceof Error) ||
+ (typeof wh == "error") );
+}
+
+/**
+ * Returns true for any object where the value of the
+ * property 'constructor' is 'Object'.
+ *
+ * Examples:
+ * <pre>
+ * dojo.lang.isPureObject(new Object()); // returns true
+ * dojo.lang.isPureObject({a: 1, b: 2}); // returns true
+ *
+ * dojo.lang.isPureObject(new Date()); // returns false
+ * dojo.lang.isPureObject([11, 2, 3]); // returns false
+ * </pre>
+ */
+dojo.lang.isPureObject = function(wh){
+ return ((wh != null) && dojo.lang.isObject(wh) && wh.constructor == Object);
+}
+
+/**
+ * Given a value and a datatype, this method returns true if the
+ * type of the value matches the datatype. The datatype parameter
+ * can be an array of datatypes, in which case the method returns
+ * true if the type of the value matches any of the datatypes.
+ *
+ * Examples:
+ * <pre>
+ * dojo.lang.isOfType("foo", String); // returns true
+ * dojo.lang.isOfType(12345, Number); // returns true
+ * dojo.lang.isOfType(false, Boolean); // returns true
+ * dojo.lang.isOfType([6, 8], Array); // returns true
+ * dojo.lang.isOfType(dojo.lang.isOfType, Function); // returns true
+ * dojo.lang.isOfType({foo: "bar"}, Object); // returns true
+ * dojo.lang.isOfType(new Date(), Date); // returns true
+ * dojo.lang.isOfType(xxxxx, Date); // returns true
+ *
+ * dojo.lang.isOfType("foo", "string"); // returns true
+ * dojo.lang.isOfType(12345, "number"); // returns true
+ * dojo.lang.isOfType(false, "boolean"); // returns true
+ * dojo.lang.isOfType([6, 8], "array"); // returns true
+ * dojo.lang.isOfType(dojo.lang.isOfType, "function"); // returns true
+ * dojo.lang.isOfType({foo: "bar"}, "object"); // returns true
+ * dojo.lang.isOfType(xxxxx, "undefined"); // returns true
+ * dojo.lang.isOfType(null, "null"); // returns true
+
+ * dojo.lang.isOfType("foo", [Number, String, Boolean]); // returns true
+ * dojo.lang.isOfType(12345, [Number, String, Boolean]); // returns true
+ * dojo.lang.isOfType(false, [Number, String, Boolean]); // returns true
+ * dojo.lang.isOfType(xxxxx, "undefined"); // returns true
+ * </pre>
+ *
+ * @param value Any literal value or object instance.
+ * @param type A class of object, or a literal type, or the string name of a type, or an array with a list of types.
+ * @return Returns a boolean
+ */
+dojo.lang.isOfType = function(value, type) {
+ if(dojo.lang.isArray(type)){
+ var arrayOfTypes = type;
+ for(var i in arrayOfTypes){
+ var aType = arrayOfTypes[i];
+ if(dojo.lang.isOfType(value, aType)) {
+ return true;
+ }
+ }
+ return false;
+ }else{
+ if(dojo.lang.isString(type)){
+ type = type.toLowerCase();
+ }
+ switch (type) {
+ case Array:
+ case "array":
+ return dojo.lang.isArray(value);
+ break;
+ case Function:
+ case "function":
+ return dojo.lang.isFunction(value);
+ break;
+ case String:
+ case "string":
+ return dojo.lang.isString(value);
+ break;
+ case Number:
+ case "number":
+ return dojo.lang.isNumber(value);
+ break;
+ case "numeric":
+ return dojo.lang.isNumeric(value);
+ break;
+ case Boolean:
+ case "boolean":
+ return dojo.lang.isBoolean(value);
+ break;
+ case Object:
+ case "object":
+ return dojo.lang.isObject(value);
+ break;
+ case "pureobject":
+ return dojo.lang.isPureObject(value);
+ break;
+ case "builtin":
+ return dojo.lang.isBuiltIn(value);
+ break;
+ case "alien":
+ return dojo.lang.isAlien(value);
+ break;
+ case "undefined":
+ return dojo.lang.isUndefined(value);
+ break;
+ case null:
+ case "null":
+ return (value === null);
+ break;
+ case "optional":
+ return ((value === null) || dojo.lang.isUndefined(value));
+ break;
+ default:
+ if (dojo.lang.isFunction(type)) {
+ return (value instanceof type);
+ } else {
+ dojo.raise("dojo.lang.isOfType() was passed an invalid type");
+ }
+ break;
+ }
+ }
+ dojo.raise("If we get here, it means a bug was introduced above.");
+}
+
+/*
+ * From reflection code, part of merge.
+ * TRT 2006-02-01
+ */
+dojo.lang.getObject=function(/* String */ str){
+ // summary
+ // Will return an object, if it exists, based on the name in the passed string.
+ var parts=str.split("."), i=0, obj=dj_global;
+ do{
+ obj=obj[parts[i++]];
+ }while(i<parts.length&&obj);
+ return (obj!=dj_global)?obj:null; // Object
+}
+
+dojo.lang.doesObjectExist=function(/* String */ str){
+ // summary
+ // Check to see if object [str] exists, based on the passed string.
+ var parts=str.split("."), i=0, obj=dj_global;
+ do{
+ obj=obj[parts[i++]];
+ }while(i<parts.length&&obj);
+ return (obj&&obj!=dj_global); // boolean
+}
Propchange: incubator/xap/trunk/src/dojo/src/lang/type.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lfx/Animation.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lfx/Animation.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lfx/Animation.js (added)
+++ incubator/xap/trunk/src/dojo/src/lfx/Animation.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,460 @@
+/*
+ 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]){
+ if(args){
+ this[evt].apply(this, args);
+ }else{
+ this[evt].apply(this);
+ }
+ }
+ },
+
+ // 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.fire("beforeBegin");
+
+ if(delay > 0){
+ setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
+ return;
+ }
+
+ 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();
+ },
+
+ pause: function() {
+ clearTimeout(this._timer);
+ if( !this._active ) { return; }
+ this._paused = true;
+ var value = this.curve.getValue(this._percent / 100);
+ this.fire("handler", ["pause", value]);
+ this.fire("onPause", [value]);
+ },
+
+ 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;
+ },
+
+ 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;
+ }
+ }
+ }
+ }
+ }
+});
+
+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);
+ dojo.event.connect(anim, "onEnd", function(){ _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.fire("beforeBegin");
+
+ if(delay > 0){
+ setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
+ return;
+ }
+
+ if(gotoStart || this._anims[0].percent == 0){
+ this.fire("onBegin");
+ }
+ this.fire("onPlay");
+ this._animsCall("play", null, gotoStart);
+ },
+
+ pause: function(){
+ this.fire("onPause");
+ this._animsCall("pause");
+ },
+
+ stop: function(gotoEnd){
+ this.fire("onStop");
+ this._animsCall("stop", gotoEnd);
+ },
+
+ // private methods
+ _onAnimsEnded: function(){
+ this._animsEnded++;
+ if(this._animsEnded >= this._anims.length){
+ this.fire("onEnd");
+ }
+ },
+
+ _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);
+ }
+});
+
+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);
+ if(i < anims_arr.length - 1){
+ dojo.event.connect(anim, "onEnd", function(){ _this._playNext(); });
+ }else{
+ dojo.event.connect(anim, "onEnd", function(){ _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; }
+ if( gotoStart || !this._anims[this._currAnim] ) {
+ this._currAnim = 0;
+ }
+
+ this.fire("beforeBegin");
+ if(delay > 0){
+ setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
+ return;
+ }
+
+ if( this._anims[this._currAnim] ){
+ if( this._currAnim == 0 ){
+ this.fire("handler", ["begin", this._currAnim]);
+ this.fire("onBegin", [this._currAnim]);
+ }
+ this.fire("onPlay", [this._currAnim]);
+ this._anims[this._currAnim].play(null, gotoStart);
+ }
+ },
+
+ pause: function(){
+ if( this._anims[this._currAnim] ) {
+ this._anims[this._currAnim].pause();
+ this.fire("onPause", [this._currAnim]);
+ }
+ },
+
+ playPause: function(){
+ if( this._anims.length == 0 ) { return; }
+ 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();
+ }
+ }
+ },
+
+ stop: function(){
+ if( this._anims[this._currAnim] ){
+ this._anims[this._currAnim].stop();
+ this.fire("onStop", [this._currAnim]);
+ }
+ },
+
+ // private methods
+ _playNext: function(){
+ if( this._currAnim == -1 || this._anims.length == 0 ) { return; }
+ this._currAnim++;
+ if( this._anims[this._currAnim] ){
+ this._anims[this._currAnim].play(null, true);
+ }
+ }
+});
+
+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);
+}
Added: incubator/xap/trunk/src/dojo/src/lfx/__package__.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lfx/__package__.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lfx/__package__.js (added)
+++ incubator/xap/trunk/src/dojo/src/lfx/__package__.js Tue Jun 27 15:39:56 2006
@@ -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.*");
\ No newline at end of file
Propchange: incubator/xap/trunk/src/dojo/src/lfx/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/lfx/extras.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lfx/extras.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lfx/extras.js (added)
+++ incubator/xap/trunk/src/dojo/src/lfx/extras.js Tue Jun 27 15:39:56 2006
@@ -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);
Added: incubator/xap/trunk/src/dojo/src/lfx/toggle.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/lfx/toggle.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/lfx/toggle.js (added)
+++ incubator/xap/trunk/src/dojo/src/lfx/toggle.js Tue Jun 27 15:39:56 2006
@@ -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();
+ }
+}
Added: incubator/xap/trunk/src/dojo/src/logging/__package__.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/logging/__package__.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/logging/__package__.js (added)
+++ incubator/xap/trunk/src/dojo/src/logging/__package__.js Tue Jun 27 15:39:56 2006
@@ -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({
+ common: ["dojo.logging.Logger", false, false],
+ rhino: ["dojo.logging.RhinoLogger"]
+});
+dojo.provide("dojo.logging.*");
Propchange: incubator/xap/trunk/src/dojo/src/logging/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/math/Math.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/math/Math.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/math/Math.js (added)
+++ incubator/xap/trunk/src/dojo/src/math/Math.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,12 @@
+/*
+ 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.deprecated("dojo.math.Math does not exist, include dojo.math");
+dojo.require("dojo.math");
Propchange: incubator/xap/trunk/src/dojo/src/math/Math.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/math/__package__.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/math/__package__.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/math/__package__.js (added)
+++ incubator/xap/trunk/src/dojo/src/math/__package__.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,18 @@
+/*
+ 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({
+ common: [
+ ["dojo.math", false, false],
+ ["dojo.math.curves", false, false],
+ ["dojo.math.points", false, false]
+ ]
+});
+dojo.provide("dojo.math.*");
Propchange: incubator/xap/trunk/src/dojo/src/math/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/math/curves.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/math/curves.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/math/curves.js (added)
+++ incubator/xap/trunk/src/dojo/src/math/curves.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,222 @@
+/*
+ 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.math.curves");
+
+dojo.require("dojo.math");
+
+/* Curves from Dan's 13th lib stuff.
+ * See: http://pupius.co.uk/js/Toolkit.Drawing.js
+ * http://pupius.co.uk/dump/dojo/Dojo.Math.js
+ */
+
+dojo.math.curves = {
+ //Creates a straight line object
+ Line: function(start, end) {
+ this.start = start;
+ this.end = end;
+ this.dimensions = start.length;
+
+ for(var i = 0; i < start.length; i++) {
+ start[i] = Number(start[i]);
+ }
+
+ for(var i = 0; i < end.length; i++) {
+ end[i] = Number(end[i]);
+ }
+
+ //simple function to find point on an n-dimensional, straight line
+ this.getValue = function(n) {
+ var retVal = new Array(this.dimensions);
+ for(var i=0;i<this.dimensions;i++)
+ retVal[i] = ((this.end[i] - this.start[i]) * n) + this.start[i];
+ return retVal;
+ }
+
+ return this;
+ },
+
+
+ //Takes an array of points, the first is the start point, the last is end point and the ones in
+ //between are the Bezier control points.
+ Bezier: function(pnts) {
+ this.getValue = function(step) {
+ if(step >= 1) return this.p[this.p.length-1]; // if step>=1 we must be at the end of the curve
+ if(step <= 0) return this.p[0]; // if step<=0 we must be at the start of the curve
+ var retVal = new Array(this.p[0].length);
+ for(var k=0;j<this.p[0].length;k++) { retVal[k]=0; }
+ for(var j=0;j<this.p[0].length;j++) {
+ var C=0; var D=0;
+ for(var i=0;i<this.p.length;i++) {
+ C += this.p[i][j] * this.p[this.p.length-1][0]
+ * dojo.math.bernstein(step,this.p.length,i);
+ }
+ for(var l=0;l<this.p.length;l++) {
+ D += this.p[this.p.length-1][0] * dojo.math.bernstein(step,this.p.length,l);
+ }
+ retVal[j] = C/D;
+ }
+ return retVal;
+ }
+ this.p = pnts;
+ return this;
+ },
+
+
+ //Catmull-Rom Spline - allows you to interpolate a smooth curve through a set of points in n-dimensional space
+ CatmullRom : function(pnts,c) {
+ this.getValue = function(step) {
+ var percent = step * (this.p.length-1);
+ var node = Math.floor(percent);
+ var progress = percent - node;
+
+ var i0 = node-1; if(i0 < 0) i0 = 0;
+ var i = node;
+ var i1 = node+1; if(i1 >= this.p.length) i1 = this.p.length-1;
+ var i2 = node+2; if(i2 >= this.p.length) i2 = this.p.length-1;
+
+ var u = progress;
+ var u2 = progress*progress;
+ var u3 = progress*progress*progress;
+
+ var retVal = new Array(this.p[0].length);
+ for(var k=0;k<this.p[0].length;k++) {
+ var x1 = ( -this.c * this.p[i0][k] ) + ( (2 - this.c) * this.p[i][k] ) + ( (this.c-2) * this.p[i1][k] ) + ( this.c * this.p[i2][k] );
+ var x2 = ( 2 * this.c * this.p[i0][k] ) + ( (this.c-3) * this.p[i][k] ) + ( (3 - 2 * this.c) * this.p[i1][k] ) + ( -this.c * this.p[i2][k] );
+ var x3 = ( -this.c * this.p[i0][k] ) + ( this.c * this.p[i1][k] );
+ var x4 = this.p[i][k];
+
+ retVal[k] = x1*u3 + x2*u2 + x3*u + x4;
+ }
+ return retVal;
+
+ }
+
+
+ if(!c) this.c = 0.7;
+ else this.c = c;
+ this.p = pnts;
+
+ return this;
+ },
+
+ // FIXME: This is the bad way to do a partial-arc with 2 points. We need to have the user
+ // supply the radius, otherwise we always get a half-circle between the two points.
+ Arc : function(start, end, ccw) {
+ var center = dojo.math.points.midpoint(start, end);
+ var sides = dojo.math.points.translate(dojo.math.points.invert(center), start);
+ var rad = Math.sqrt(Math.pow(sides[0], 2) + Math.pow(sides[1], 2));
+ var theta = dojo.math.radToDeg(Math.atan(sides[1]/sides[0]));
+ if( sides[0] < 0 ) {
+ theta -= 90;
+ } else {
+ theta += 90;
+ }
+ dojo.math.curves.CenteredArc.call(this, center, rad, theta, theta+(ccw?-180:180));
+ },
+
+ // Creates an arc object, with center and radius (Top of arc = 0 degrees, increments clockwise)
+ // center => 2D point for center of arc
+ // radius => scalar quantity for radius of arc
+ // start => to define an arc specify start angle (default: 0)
+ // end => to define an arc specify start angle
+ CenteredArc : function(center, radius, start, end) {
+ this.center = center;
+ this.radius = radius;
+ this.start = start || 0;
+ this.end = end;
+
+ this.getValue = function(n) {
+ var retVal = new Array(2);
+ var theta = dojo.math.degToRad(this.start+((this.end-this.start)*n));
+
+ retVal[0] = this.center[0] + this.radius*Math.sin(theta);
+ retVal[1] = this.center[1] - this.radius*Math.cos(theta);
+
+ return retVal;
+ }
+
+ return this;
+ },
+
+ // Special case of Arc (start = 0, end = 360)
+ Circle : function(center, radius) {
+ dojo.math.curves.CenteredArc.call(this, center, radius, 0, 360);
+ return this;
+ },
+
+ Path : function() {
+ var curves = [];
+ var weights = [];
+ var ranges = [];
+ var totalWeight = 0;
+
+ this.add = function(curve, weight) {
+ if( weight < 0 ) { dojo.raise("dojo.math.curves.Path.add: weight cannot be less than 0"); }
+ curves.push(curve);
+ weights.push(weight);
+ totalWeight += weight;
+ computeRanges();
+ }
+
+ this.remove = function(curve) {
+ for(var i = 0; i < curves.length; i++) {
+ if( curves[i] == curve ) {
+ curves.splice(i, 1);
+ totalWeight -= weights.splice(i, 1)[0];
+ break;
+ }
+ }
+ computeRanges();
+ }
+
+ this.removeAll = function() {
+ curves = [];
+ weights = [];
+ totalWeight = 0;
+ }
+
+ this.getValue = function(n) {
+ var found = false, value = 0;
+ for(var i = 0; i < ranges.length; i++) {
+ var r = ranges[i];
+ //w(r.join(" ... "));
+ if( n >= r[0] && n < r[1] ) {
+ var subN = (n - r[0]) / r[2];
+ value = curves[i].getValue(subN);
+ found = true;
+ break;
+ }
+ }
+
+ // FIXME: Do we want to assume we're at the end?
+ if( !found ) {
+ value = curves[curves.length-1].getValue(1);
+ }
+
+ for(j = 0; j < i; j++) {
+ value = dojo.math.points.translate(value, curves[j].getValue(1));
+ }
+ return value;
+ }
+
+ function computeRanges() {
+ var start = 0;
+ for(var i = 0; i < weights.length; i++) {
+ var end = start + weights[i] / totalWeight;
+ var len = end - start;
+ ranges[i] = [start, end, len];
+ start = end;
+ }
+ }
+
+ return this;
+ }
+};
Propchange: incubator/xap/trunk/src/dojo/src/math/curves.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/math/matrix.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/math/matrix.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/math/matrix.js (added)
+++ incubator/xap/trunk/src/dojo/src/math/matrix.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,305 @@
+/*
+ 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.math.matrix");
+
+//
+// some of this code is based on
+// http://www.mkaz.com/math/MatrixCalculator.java
+// (published under a BSD Open Source License)
+//
+// the rest is from my vague memory of matricies in school [cal]
+//
+// the copying of arguments is a little excessive, and could be trimmed back in
+// the case where a function doesn't modify them at all (but some do!)
+//
+
+dojo.math.matrix.iDF = 0;
+
+dojo.math.matrix.multiply = function(a, b){
+
+ a = dojo.math.matrix.copy(a);
+ b = dojo.math.matrix.copy(b);
+
+ var ax = a[0].length;
+ var ay = a.length;
+ var bx = b[0].length;
+ var by = b.length;
+
+ if (ax != by){
+ dojo.debug("Can't multiply matricies of sizes "+ax+','+ay+' and '+bx+','+by);
+ return [[0]];
+ }
+
+ var c = [];
+
+ for(var k=0; k<ay; k++){
+ c[k] = [];
+ for(var i=0; i<bx; i++){
+
+ c[k][i] = 0;
+
+ for(var m=0; m<ax; m++){
+
+ c[k][i] += a[k][m]*b[m][i];
+ }
+ }
+ }
+
+ return c;
+}
+
+dojo.math.matrix.inverse = function(a){
+
+ a = dojo.math.matrix.copy(a);
+
+ // Formula used to Calculate Inverse:
+ // inv(A) = 1/det(A) * adj(A)
+
+ var tms = a.length;
+
+ var m = dojo.math.matrix.create(tms, tms);
+ var mm = dojo.math.matrix.adjoint(a);
+
+ var det = dojo.math.matrix.determinant(a);
+ var dd = 0;
+
+ if (det == 0){
+ dojo.debug("Determinant Equals 0, Not Invertible.");
+ return [[0]];
+ }else{
+ dd = 1 / det;
+ }
+
+ for (var i = 0; i < tms; i++)
+ for (var j = 0; j < tms; j++) {
+ m[i][j] = dd * mm[i][j];
+ }
+
+ return m;
+}
+
+dojo.math.matrix.determinant = function(a){
+
+ a = dojo.math.matrix.copy(a);
+
+ if (a.length != a[0].length){
+ dojo.debug("Can't calculate the determiant of a non-squre matrix!");
+ return 0;
+ }
+
+ var tms = a.length;
+ var det = 1;
+
+ var b = dojo.math.matrix.upperTriangle(a);
+
+ for (var i=0; i < tms; i++){
+ det *= b[i][i];
+ }
+
+ det = det * dojo.math.matrix.iDF;
+
+ return det;
+}
+
+dojo.math.matrix.upperTriangle = function(m){
+
+ m = dojo.math.matrix.copy(m);
+
+ var f1 = 0;
+ var temp = 0;
+ var tms = m.length;
+ var v = 1;
+
+ dojo.math.matrix.iDF = 1;
+
+ for (var col = 0; col < tms - 1; col++) {
+ for (var row = col + 1; row < tms; row++) {
+ v = 1;
+
+ var stop_loop = 0;
+
+ // check if 0 in diagonal
+ while ((m[col][col] == 0) && !stop_loop){
+
+ // if so switch until not
+ if (col + v >= tms){
+
+ // check if switched all rows
+ dojo.math.matrix.iDF = 0;
+ stop_loop = 1;
+ }else{
+ for (var c = 0; c < tms; c++) {
+ temp = m[col][c];
+ m[col][c] = m[col + v][c]; // switch rows
+ m[col + v][c] = temp;
+ }
+ v++; // count row switchs
+ dojo.math.matrix.iDF *= -1; // each switch changes determinant factor
+ }
+ }
+
+ if (m[col][col] != 0) {
+ f1 = (-1) * m[row][col] / m[col][col];
+ for (var i = col; i < tms; i++) {
+ m[row][i] = f1 * m[col][i] + m[row][i];
+ }
+ }
+ }
+ }
+
+ return m;
+}
+
+dojo.math.matrix.create = function(a, b){
+ var m = [];
+ for(var i=0; i<b; i++){
+ m[i] = [];
+ for(var j=0; j<a; j++){
+ m[i][j] = 0;
+ }
+ }
+ return m;
+}
+
+dojo.math.matrix.adjoint = function(a){
+
+ a = dojo.math.matrix.copy(a);
+
+ var tms = a.length;
+
+ if (a.length != a[0].length){
+ dojo.debug("Can't find the adjoint of a non-square matrix");
+ return [[0]];
+ }
+
+ if (tms == 1){
+ dojo.debug("Can't find the adjoint of a 1x1 matrix");
+ return [[0]];
+ }
+
+ var m = dojo.math.matrix.create(tms, tms);
+
+ var ii = 0;
+ var jj = 0;
+ var ia = 0;
+ var ja = 0;
+ var det = 0;
+
+ for (var i = 0; i < tms; i++){
+ for (var j = 0; j < tms; j++){
+
+ ia = 0;
+ ja = 0;
+
+ var ap = dojo.math.matrix.create(tms-1, tms-1);
+
+ for (ii = 0; ii < tms; ii++) {
+ for (jj = 0; jj < tms; jj++) {
+
+ if ((ii != i) && (jj != j)) {
+ ap[ia][ja] = a[ii][jj];
+ ja++;
+ }
+
+ }
+
+ if ((ii != i) && (jj != j)) {
+ ia++;
+ }
+ ja = 0;
+ }
+
+ det = dojo.math.matrix.determinant(ap);
+ m[i][j] = Math.pow(-1 , (i + j)) * det;
+ }
+ }
+
+ m = dojo.math.matrix.transpose(m);
+
+ return m;
+}
+
+dojo.math.matrix.transpose = function(a){
+
+ a = dojo.math.matrix.copy(a);
+
+ var m = dojo.math.matrix.create(a.length, a[0].length);
+
+ for (var i = 0; i < a.length; i++)
+ for (var j = 0; j < a[i].length; j++)
+ m[j][i] = a[i][j];
+ return m;
+}
+
+dojo.math.matrix.format = function(a){
+
+ function format_int(x){
+ var dp = 5;
+ var fac = Math.pow(10 , dp);
+ var a = Math.round(x*fac)/fac;
+ var b = a.toString();
+ if (b.charAt(0) != '-'){ b = ' ' + b;}
+ var has_dp = 0;
+ for(var i=1; i<b.length; i++){
+ if (b.charAt(i) == '.'){ has_dp = 1; }
+ }
+ if (!has_dp){ b += '.'; }
+ while(b.length < dp+3){ b += '0'; }
+ return b;
+ }
+
+ var ya = a.length;
+ var xa = a[0].length;
+
+ var buffer = '';
+
+ for (var y=0; y<ya; y++){
+ buffer += '| ';
+ for (var x=0; x<xa; x++){
+ buffer += format_int(a[y][x]) + ' ';
+ }
+ buffer += '|\n';
+ }
+
+ return buffer;
+}
+
+dojo.math.matrix.copy = function(a){
+
+ var ya = a.length;
+ var xa = a[0].length;
+
+ var m = dojo.math.matrix.create(xa, ya);
+
+ for (var y=0; y<ya; y++){
+ for (var x=0; x<xa; x++){
+ m[y][x] = a[y][x];
+ }
+ }
+
+ return m;
+}
+
+dojo.math.matrix.scale = function(k, a){
+
+ a = dojo.math.matrix.copy(a);
+
+ var ya = a.length;
+ var xa = a[0].length;
+
+ for (var y=0; y<ya; y++){
+ for (var x=0; x<xa; x++){
+ a[y][x] *= k;
+ }
+ }
+
+ return a;
+}
Propchange: incubator/xap/trunk/src/dojo/src/math/matrix.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/math/points.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/math/points.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/math/points.js (added)
+++ incubator/xap/trunk/src/dojo/src/math/points.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,47 @@
+/*
+ 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.math.points");
+dojo.require("dojo.math");
+
+// TODO: add a Point class?
+dojo.math.points = {
+ translate: function(a, b) {
+ if( a.length != b.length ) {
+ dojo.raise("dojo.math.translate: points not same size (a:[" + a + "], b:[" + b + "])");
+ }
+ var c = new Array(a.length);
+ for(var i = 0; i < a.length; i++) {
+ c[i] = a[i] + b[i];
+ }
+ return c;
+ },
+
+ midpoint: function(a, b) {
+ if( a.length != b.length ) {
+ dojo.raise("dojo.math.midpoint: points not same size (a:[" + a + "], b:[" + b + "])");
+ }
+ var c = new Array(a.length);
+ for(var i = 0; i < a.length; i++) {
+ c[i] = (a[i] + b[i]) / 2;
+ }
+ return c;
+ },
+
+ invert: function(a) {
+ var b = new Array(a.length);
+ for(var i = 0; i < a.length; i++) { b[i] = -a[i]; }
+ return b;
+ },
+
+ distance: function(a, b) {
+ return Math.sqrt(Math.pow(b[0]-a[0], 2) + Math.pow(b[1]-a[1], 2));
+ }
+};
Propchange: incubator/xap/trunk/src/dojo/src/math/points.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/reflect/__package__.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/reflect/__package__.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/reflect/__package__.js (added)
+++ incubator/xap/trunk/src/dojo/src/reflect/__package__.js Tue Jun 27 15:39:56 2006
@@ -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.deprecated("dojo.reflect is merged into dojo.lang (dojo.lang[type]). Will be removed by 0.4");
+dojo.kwCompoundRequire({
+ common: ["dojo.reflect.reflection"]
+});
+dojo.provide("dojo.reflect.*");
Propchange: incubator/xap/trunk/src/dojo/src/reflect/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/dojo/src/reflect/reflection.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/dojo/src/reflect/reflection.js?rev=417614&view=auto
==============================================================================
--- incubator/xap/trunk/src/dojo/src/reflect/reflection.js (added)
+++ incubator/xap/trunk/src/dojo/src/reflect/reflection.js Tue Jun 27 15:39:56 2006
@@ -0,0 +1,198 @@
+/*
+ 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.deprecated("dojo.reflect is merged into dojo.lang (dojo.lang[type]). Will be removed by 0.4");
+dojo.provide("dojo.reflect");
+
+/*****************************************************************
+ reflect.js
+ v.1.5.0
+ (c) 2003-2004 Thomas R. Trenka, Ph.D.
+
+ Derived from the reflection functions of f(m).
+ http://dojotoolkit.org
+ http://fm.dept-z.com
+
+ There is a dependency on the variable dJ_global, which
+ should always refer to the global object.
+******************************************************************/
+if(!dj_global){ var dj_global = this; }
+
+dojo.reflect = {} ;
+dojo.reflect.$unknownType = function(){ } ;
+dojo.reflect.ParameterInfo = function(name, type){
+ this.name = name ;
+ this.type = (type) ? type : dojo.reflect.$unknownType ;
+} ;
+dojo.reflect.PropertyInfo = function(name, type) {
+ this.name = name ;
+ this.type = (type) ? type : dojo.reflect.$unknownType ;
+} ;
+dojo.reflect.MethodInfo = function(name, fn){
+ var parse = function(f) {
+ var o = {} ;
+ var s = f.toString() ;
+ var param = ((s.substring(s.indexOf('(')+1, s.indexOf(')'))).replace(/\s+/g, "")).split(",") ;
+ o.parameters = [] ;
+ for (var i = 0; i < param.length; i++) {
+ o.parameters.push(new dojo.reflect.ParameterInfo(param[i])) ;
+ }
+ o.body = (s.substring(s.indexOf('{')+1, s.lastIndexOf('}'))).replace(/(^\s*)|(\s*$)/g, "") ;
+ return o ;
+ } ;
+
+ var tmp = parse(fn) ;
+ var p = tmp.parameters ;
+ var body = tmp.body ;
+
+ this.name = (name) ? name : "anonymous" ;
+ this.getParameters = function(){ return p ; } ;
+ this.getNullArgumentsObject = function() {
+ var a = [] ;
+ for (var i = 0; i < p.length; i++){
+ a.push(null);
+ }
+ return a ;
+ } ;
+ this.getBody = function() { return body ; } ;
+ this.type = Function ;
+ this.invoke = function(src, args){ return fn.apply(src, args) ; } ;
+} ;
+
+// Static object that can activate instances of the passed type.
+dojo.reflect.Activator = new (function(){
+ this.createInstance = function(type, args) {
+ switch (typeof(type)) {
+ case "function" : {
+ var o = {} ;
+ type.apply(o, args) ;
+ return o ;
+ } ;
+ case "string" : {
+ var o = {} ;
+ (dojo.reflect.Reflector.getTypeFromString(type)).apply(o, args) ;
+ return o ;
+ } ;
+ }
+ throw new Error("dojo.reflect.Activator.createInstance(): no such type exists.");
+ }
+})() ;
+
+dojo.reflect.Reflector = new (function(){
+ this.getTypeFromString = function(s) {
+ var parts = s.split("."), i = 0, obj = dj_global ;
+ do { obj = obj[parts[i++]] ; } while (i < parts.length && obj) ;
+ return (obj != dj_global) ? obj : null ;
+ };
+
+ this.typeExists = function(s) {
+ var parts = s.split("."), i = 0, obj = dj_global ;
+ do { obj = obj[parts[i++]] ; } while (i < parts.length && obj) ;
+ return (obj && obj != dj_global) ;
+ };
+
+ this.getFieldsFromType = function(s) {
+ var type = s ;
+ if (typeof(s) == "string") {
+ type = this.getTypeFromString(s) ;
+ }
+ var nullArgs = (new dojo.reflect.MethodInfo(type)).getNullArgumentsObject() ;
+ return this.getFields(dojo.reflect.Activator.createInstance(s, nullArgs)) ;
+ };
+
+ this.getPropertiesFromType = function(s) {
+ var type = s ;
+ if (typeof(s) == "string") {
+ type = this.getTypeFromString(s);
+ }
+ var nullArgs = (new dojo.reflect.MethodInfo(type)).getNullArgumentsObject() ;
+ return this.getProperties(dojo.reflect.Activator.createInstance(s, nullArgs)) ;
+ };
+
+ this.getMethodsFromType = function(s) {
+ var type = s ;
+ if (typeof(s) == "string") {
+ type = this.getTypeFromString(s) ;
+ }
+ var nullArgs = (new dojo.reflect.MethodInfo(type)).getNullArgumentsObject() ;
+ return this.getMethods(dojo.reflect.Activator.createInstance(s, nullArgs)) ;
+ };
+
+ this.getType = function(o) { return o.constructor ; } ;
+
+ this.getFields = function(obj) {
+ var arr = [] ;
+ for (var p in obj) {
+ if(this.getType(obj[p]) != Function){
+ arr.push(new dojo.reflect.PropertyInfo(p, this.getType(obj[p]))) ;
+ }else{
+ arr.push(new dojo.reflect.MethodInfo(p, obj[p]));
+ }
+ }
+ return arr ;
+ };
+
+ this.getProperties = function(obj) {
+ var arr = [] ;
+ var fi = this.getFields(obj) ;
+ for (var i = 0; i < fi.length; i++){
+ if (this.isInstanceOf(fi[i], dojo.reflect.PropertyInfo)){
+ arr.push(fi[i]) ;
+ }
+ }
+ return arr ;
+ };
+
+ this.getMethods = function(obj) {
+ var arr = [] ;
+ var fi = this.getFields(obj) ;
+ for (var i = 0; i < fi.length; i++){
+ if (this.isInstanceOf(fi[i], dojo.reflect.MethodInfo)){
+ arr.push(fi[i]) ;
+ }
+ }
+ return arr ;
+ };
+
+ /*
+ this.implements = function(o, type) {
+ if (this.isSubTypeOf(o, type)) return false ;
+ var f = this.getFieldsFromType(type) ;
+ for (var i = 0; i < f.length; i++) {
+ if (typeof(o[(f[i].name)]) == "undefined"){
+ return false;
+ }
+ }
+ return true ;
+ };
+ */
+
+ this.getBaseClass = function(o) {
+ if (o.getType().prototype.prototype.constructor){
+ return (o.getType()).prototype.prototype.constructor ;
+ }
+ return Object ;
+ } ;
+
+ this.isInstanceOf = function(o, type) {
+ return (this.getType(o) == type) ;
+ };
+
+ this.isSubTypeOf = function(o, type) {
+ return (o instanceof type) ;
+ };
+
+ this.isBaseTypeOf = function(o, type) {
+ return (type instanceof o);
+ };
+})();
+
+// back-compat
+dojo.provide("dojo.reflect.reflection");
Propchange: incubator/xap/trunk/src/dojo/src/reflect/reflection.js
------------------------------------------------------------------------------
svn:eol-style = native