You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/06/10 16:27:54 UTC
svn commit: r413306 [9/17] - in /tapestry/tapestry4/trunk:
examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/
framework/src/java/org/apache/tapestry/
framework/src/java/org/apache/tapestry/dojo/form/
framework/src/java/org/apache/tapes...
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/extras.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/extras.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/extras.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/extras.js Sat Jun 10 07:27:44 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: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/extras.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/func.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/func.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/func.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/func.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,150 @@
+/*
+ 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, searchForNames){
+ var nso = (namespaceObj || dojo.lang.anon);
+ if( (searchForNames) ||
+ ((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: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/func.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/repr.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/repr.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/repr.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/repr.js Sat Jun 10 07:27:44 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: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/repr.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/type.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/type.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/type.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/type.js Sat Jun 10 07:27:44 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: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lang/type.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/Animation.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/Animation.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/Animation.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/Animation.js Sat Jun 10 07:27:44 2006
@@ -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);
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/Animation.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/__package__.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/__package__.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/__package__.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/__package__.js Sat Jun 10 07:27:44 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.*");
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/html.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/html.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/html.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/html.js Sat Jun 10 07:27:44 2006
@@ -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);
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/html.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/toggle.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/toggle.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/toggle.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/toggle.js Sat Jun 10 07:27:44 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();
+ }
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/lfx/toggle.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/math/matrix.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/math/matrix.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/math/matrix.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/math/matrix.js Sat Jun 10 07:27:44 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: tapestry/tapestry4/trunk/framework/src/js/dojo/src/math/matrix.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/profile.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/profile.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/profile.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/profile.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,117 @@
+/*
+ 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.profile");
+
+dojo.profile = new function(){
+ var profiles = {};
+ var pns = [];
+
+ this.start = function(name){
+ if(!profiles[name]){
+ profiles[name] = {iters: 0, total: 0};
+ pns[pns.length] = name;
+ }else{
+ if(profiles[name]["start"]){
+ this.end(name);
+ }
+ }
+ profiles[name].end = null;
+ profiles[name].start = new Date();
+ }
+
+ this.end = function(name){
+ var ed = new Date();
+ if((profiles[name])&&(profiles[name]["start"])){
+ with(profiles[name]){
+ end = ed;
+ total += (end - start);
+ start = null;
+ iters++;
+ }
+ }else{
+ // oops! bad call to end(), what should we do here?
+ return true;
+ }
+ }
+
+ this.stop = this.end;
+
+ this.dump = function(appendToDoc){
+ var tbl = document.createElement("table");
+ with(tbl.style){
+ border = "1px solid black";
+ borderCollapse = "collapse";
+ }
+ var hdr = tbl.createTHead();
+ var hdrtr = hdr.insertRow(0);
+ // document.createElement("tr");
+ var cols = ["Identifier","Calls","Total","Avg"];
+ for(var x=0; x<cols.length; x++){
+ var ntd = hdrtr.insertCell(x);
+ with(ntd.style){
+ backgroundColor = "#225d94";
+ color = "white";
+ borderBottom = "1px solid black";
+ borderRight = "1px solid black";
+ fontFamily = "tahoma";
+ fontWeight = "bolder";
+ paddingLeft = paddingRight = "5px";
+ }
+ ntd.appendChild(document.createTextNode(cols[x]));
+ }
+
+ for(var x=0; x < pns.length; x++){
+ var prf = profiles[pns[x]];
+ this.end(pns[x]);
+ if(prf.iters>0){
+ var bdytr = tbl.insertRow(true);
+ var vals = [pns[x], prf.iters, prf.total, parseInt(prf.total/prf.iters)];
+ for(var y=0; y<vals.length; y++){
+ var cc = bdytr.insertCell(y);
+ cc.appendChild(document.createTextNode(vals[y]));
+ with(cc.style){
+ borderBottom = "1px solid gray";
+ paddingLeft = paddingRight = "5px";
+ if(x%2){
+ backgroundColor = "#e1f1ff";
+ }
+ if(y>0){
+ textAlign = "right";
+ borderRight = "1px solid gray";
+ }else{
+ borderRight = "1px solid black";
+ }
+ }
+ }
+ }
+ }
+
+ if(appendToDoc){
+ var ne = document.createElement("div");
+ ne.id = "profileOutputTable";
+ with(ne.style){
+ fontFamily = "Courier New, monospace";
+ fontSize = "12px";
+ lineHeight = "16px";
+ borderTop = "1px solid black";
+ padding = "10px";
+ }
+ if(document.getElementById("profileOutputTable")){
+ document.body.replaceChild(ne, document.getElementById("profileOutputTable"));
+ }else{
+ document.body.appendChild(ne);
+ }
+ ne.appendChild(tbl);
+ }
+
+ return tbl;
+ }
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/profile.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/regexp.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/regexp.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/regexp.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/regexp.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,566 @@
+/*
+ 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.regexp");
+dojo.provide("dojo.regexp.us");
+
+// *** Regular Expression Generators ***
+
+/**
+ Builds a RE that matches a top-level domain.
+
+ @param flags An object.
+ flags.allowCC Include 2 letter country code domains. Default is true.
+ flags.allowGeneric Include the generic domains. Default is true.
+ flags.allowInfra Include infrastructure domains. Default is true.
+
+ @return A string for a regular expression for a top-level domain.
+*/
+dojo.regexp.tld = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.allowCC != "boolean") { flags.allowCC = true; }
+ if (typeof flags.allowInfra != "boolean") { flags.allowInfra = true; }
+ if (typeof flags.allowGeneric != "boolean") { flags.allowGeneric = true; }
+
+ // Infrastructure top-level domain - only one at present
+ var infraRE = "arpa";
+
+ // Generic top-level domains RE.
+ var genericRE =
+ "aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|xxx|jobs|mobi|post";
+
+ // Country Code top-level domains RE
+ var ccRE =
+ "ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|" +
+ "bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|" +
+ "ec|ee|eg|er|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|" +
+ "hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|" +
+ "lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|" +
+ "mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|" +
+ "ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|" +
+ "to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw";
+
+ // Build top-level domain RE
+ var a = [];
+ if (flags.allowInfra) { a.push(infraRE); }
+ if (flags.allowGeneric) { a.push(genericRE); }
+ if (flags.allowCC) { a.push(ccRE); }
+
+ var tldRE = "";
+ if (a.length > 0) {
+ tldRE = "(" + a.join("|") + ")";
+ }
+
+ return tldRE;
+}
+
+/**
+ Builds a RE that matches an IP Address.
+ Supports 5 formats for IPv4: dotted decimal, dotted hex, dotted octal, decimal and hexadecimal.
+ Supports 2 formats for Ipv6.
+
+ @param flags An object. All flags are boolean with default = true.
+ flags.allowDottedDecimal Example, 207.142.131.235. No zero padding.
+ flags.allowDottedHex Example, 0x18.0x11.0x9b.0x28. Case insensitive. Zero padding allowed.
+ flags.allowDottedOctal Example, 0030.0021.0233.0050. Zero padding allowed.
+ flags.allowDecimal Example, 3482223595. A decimal number between 0-4294967295.
+ flags.allowHex Example, 0xCF8E83EB. Hexadecimal number between 0x0-0xFFFFFFFF.
+ Case insensitive. Zero padding allowed.
+ flags.allowIPv6 IPv6 address written as eight groups of four hexadecimal digits.
+ flags.allowHybrid IPv6 address written as six groups of four hexadecimal digits
+ followed by the usual 4 dotted decimal digit notation of IPv4. x:x:x:x:x:x:d.d.d.d
+
+ @return A string for a regular expression for an IP address.
+*/
+dojo.regexp.ipAddress = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.allowDottedDecimal != "boolean") { flags.allowDottedDecimal = true; }
+ if (typeof flags.allowDottedHex != "boolean") { flags.allowDottedHex = true; }
+ if (typeof flags.allowDottedOctal != "boolean") { flags.allowDottedOctal = true; }
+ if (typeof flags.allowDecimal != "boolean") { flags.allowDecimal = true; }
+ if (typeof flags.allowHex != "boolean") { flags.allowHex = true; }
+ if (typeof flags.allowIPv6 != "boolean") { flags.allowIPv6 = true; }
+ if (typeof flags.allowHybrid != "boolean") { flags.allowHybrid = true; }
+
+ // decimal-dotted IP address RE.
+ var dottedDecimalRE =
+ // Each number is between 0-255. Zero padding is not allowed.
+ "((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
+
+ // dotted hex IP address RE. Each number is between 0x0-0xff. Zero padding is allowed, e.g. 0x00.
+ var dottedHexRE = "(0[xX]0*[\\da-fA-F]?[\\da-fA-F]\\.){3}0[xX]0*[\\da-fA-F]?[\\da-fA-F]";
+
+ // dotted octal IP address RE. Each number is between 0000-0377.
+ // Zero padding is allowed, but each number must have at least 4 characters.
+ var dottedOctalRE = "(0+[0-3][0-7][0-7]\\.){3}0+[0-3][0-7][0-7]";
+
+ // decimal IP address RE. A decimal number between 0-4294967295.
+ var decimalRE = "(0|[1-9]\\d{0,8}|[1-3]\\d{9}|4[01]\\d{8}|42[0-8]\\d{7}|429[0-3]\\d{6}|" +
+ "4294[0-8]\\d{5}|42949[0-5]\\d{4}|429496[0-6]\\d{3}|4294967[01]\\d{2}|42949672[0-8]\\d|429496729[0-5])";
+
+ // hexadecimal IP address RE.
+ // A hexadecimal number between 0x0-0xFFFFFFFF. Case insensitive. Zero padding is allowed.
+ var hexRE = "0[xX]0*[\\da-fA-F]{1,8}";
+
+ // IPv6 address RE.
+ // The format is written as eight groups of four hexadecimal digits, x:x:x:x:x:x:x:x,
+ // where x is between 0000-ffff. Zero padding is optional. Case insensitive.
+ var ipv6RE = "([\\da-fA-F]{1,4}\\:){7}[\\da-fA-F]{1,4}";
+
+ // IPv6/IPv4 Hybrid address RE.
+ // The format is written as six groups of four hexadecimal digits,
+ // followed by the 4 dotted decimal IPv4 format. x:x:x:x:x:x:d.d.d.d
+ var hybridRE = "([\\da-fA-F]{1,4}\\:){6}" +
+ "((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
+
+ // Build IP Address RE
+ var a = [];
+ if (flags.allowDottedDecimal) { a.push(dottedDecimalRE); }
+ if (flags.allowDottedHex) { a.push(dottedHexRE); }
+ if (flags.allowDottedOctal) { a.push(dottedOctalRE); }
+ if (flags.allowDecimal) { a.push(decimalRE); }
+ if (flags.allowHex) { a.push(hexRE); }
+ if (flags.allowIPv6) { a.push(ipv6RE); }
+ if (flags.allowHybrid) { a.push(hybridRE); }
+
+ var ipAddressRE = "";
+ if (a.length > 0) {
+ ipAddressRE = "(" + a.join("|") + ")";
+ }
+
+ return ipAddressRE;
+}
+
+/**
+ Builds a RE that matches a host.
+ A host is a domain name or an IP address, possibly followed by a port number.
+
+ @param flags An object.
+ flags.allowIP Allow an IP address for hostname. Default is true.
+ flags.allowLocal Allow the host to be "localhost". Default is false.
+ flags.allowPort Allow a port number to be present. Default is true.
+ flags in regexp.ipAddress can be applied.
+ flags in regexp.tld can be applied.
+
+ @return A string for a regular expression for a host.
+*/
+dojo.regexp.host = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.allowIP != "boolean") { flags.allowIP = true; }
+ if (typeof flags.allowLocal != "boolean") { flags.allowLocal = false; }
+ if (typeof flags.allowPort != "boolean") { flags.allowPort = true; }
+
+ // Domain names can not end with a dash.
+ var domainNameRE = "([0-9a-zA-Z]([-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?\\.)+" + dojo.regexp.tld(flags);
+
+ // port number RE
+ var portRE = ( flags.allowPort ) ? "(\\:" + dojo.regexp.integer({signed: false}) + ")?" : "";
+
+ // build host RE
+ var hostNameRE = domainNameRE;
+ if (flags.allowIP) { hostNameRE += "|" + dojo.regexp.ipAddress(flags); }
+ if (flags.allowLocal) { hostNameRE += "|localhost"; }
+
+ return "(" + hostNameRE + ")" + portRE;
+}
+
+/**
+ Builds a regular expression that matches a URL.
+
+ @param flags An object.
+ flags.scheme Can be true, false, or [true, false].
+ This means: required, not allowed, or match either one.
+ flags in regexp.host can be applied.
+ flags in regexp.ipAddress can be applied.
+ flags in regexp.tld can be applied.
+
+ @return A string for a regular expression for a URL.
+*/
+dojo.regexp.url = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.scheme == "undefined") { flags.scheme = [true, false]; }
+
+ // Scheme RE
+ var protocalRE = dojo.regexp.buildGroupRE(flags.scheme,
+ function(q) { if (q) { return "(https?|ftps?)\\://"; } return ""; }
+ );
+
+ // Path and query and anchor RE
+ var pathRE = "(/([^?#\\s/]+/)*)?([^?#\\s/]+(\\?[^?#\\s/]*)?(#[A-Za-z][\\w.:-]*)?)?";
+
+ return (protocalRE + dojo.regexp.host(flags) + pathRE);
+}
+
+/**
+ Builds a regular expression that matches an email address.
+
+ @param flags An object.
+ flags.allowCruft Allow address like <ma...@yahoo.com>. Default is false.
+ flags in regexp.host can be applied.
+ flags in regexp.ipAddress can be applied.
+ flags in regexp.tld can be applied.
+
+ @return A string for a regular expression for an email address.
+*/
+dojo.regexp.emailAddress = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.allowCruft != "boolean") { flags.allowCruft = false; }
+ flags.allowPort = false; // invalid in email addresses
+
+ // user name RE - apostrophes are valid if there's not 2 in a row
+ var usernameRE = "([\\da-z]+[-._+&'])*[\\da-z]+";
+
+ // build emailAddress RE
+ var emailAddressRE = usernameRE + "@" + dojo.regexp.host(flags);
+
+ // Allow email addresses with cruft
+ if ( flags.allowCruft ) {
+ emailAddressRE = "<?(mailto\\:)?" + emailAddressRE + ">?";
+ }
+
+ return emailAddressRE;
+}
+
+/**
+ Builds a regular expression that matches a list of email addresses.
+
+ @param flags An object.
+ flags.listSeparator The character used to separate email addresses. Default is ";", ",", "\n" or " ".
+ flags in regexp.emailAddress can be applied.
+ flags in regexp.host can be applied.
+ flags in regexp.ipAddress can be applied.
+ flags in regexp.tld can be applied.
+
+ @return A string for a regular expression for an email address list.
+*/
+dojo.regexp.emailAddressList = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.listSeparator != "string") { flags.listSeparator = "\\s;,"; }
+
+ // build a RE for an Email Address List
+ var emailAddressRE = dojo.regexp.emailAddress(flags);
+ var emailAddressListRE = "(" + emailAddressRE + "\\s*[" + flags.listSeparator + "]\\s*)*" +
+ emailAddressRE + "\\s*[" + flags.listSeparator + "]?\\s*";
+
+ return emailAddressListRE;
+}
+
+/**
+ Builds a regular expression that matches an integer.
+
+ @param flags An object.
+ flags.signed The leading plus-or-minus sign. Can be true, false, or [true, false].
+ Default is [true, false], (i.e. will match if it is signed or unsigned).
+ flags.separator The character used as the thousands separator. Default is no separator.
+ For more than one symbol use an array, e.g. [",", ""], makes ',' optional.
+
+ @return A string for a regular expression for an integer.
+*/
+dojo.regexp.integer = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.signed == "undefined") { flags.signed = [true, false]; }
+ if (typeof flags.separator == "undefined") { flags.separator = ""; }
+
+ // build sign RE
+ var signRE = dojo.regexp.buildGroupRE(flags.signed,
+ function(q) { if (q) { return "[-+]"; } return ""; }
+ );
+
+ // number RE
+ var numberRE = dojo.regexp.buildGroupRE(flags.separator,
+ function(sep) {
+ if ( sep == "" ) {
+ return "(0|[1-9]\\d*)";
+ }
+ return "(0|[1-9]\\d{0,2}([" + sep + "]\\d{3})*)";
+ }
+ );
+ var numberRE;
+
+ // integer RE
+ return (signRE + numberRE);
+}
+
+/**
+ Builds a regular expression to match a real number in exponential notation.
+
+ @param flags An object.
+ flags.places The integer number of decimal places.
+ If not given, the decimal part is optional and the number of places is unlimited.
+ flags.decimal A string for the character used as the decimal point. Default is ".".
+ flags.exponent Express in exponential notation. Can be true, false, or [true, false].
+ Default is [true, false], (i.e. will match if the exponential part is present are not).
+ flags.eSigned The leading plus-or-minus sign on the exponent. Can be true, false,
+ or [true, false]. Default is [true, false], (i.e. will match if it is signed or unsigned).
+ flags in regexp.integer can be applied.
+
+ @return A string for a regular expression for a real number.
+*/
+dojo.regexp.realNumber = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.places != "number") { flags.places = Infinity; }
+ if (typeof flags.decimal != "string") { flags.decimal = "."; }
+ if (typeof flags.exponent == "undefined") { flags.exponent = [true, false]; }
+ if (typeof flags.eSigned == "undefined") { flags.eSigned = [true, false]; }
+
+ // integer RE
+ var integerRE = dojo.regexp.integer(flags);
+
+ // decimal RE
+ var decimalRE = "";
+ if ( flags.places == Infinity) {
+ decimalRE = "(\\" + flags.decimal + "\\d+)?";
+ }
+ else if ( flags.places > 0) {
+ decimalRE = "\\" + flags.decimal + "\\d{" + flags.places + "}";
+ }
+
+ // exponent RE
+ var exponentRE = dojo.regexp.buildGroupRE(flags.exponent,
+ function(q) {
+ if (q) { return "([eE]" + dojo.regexp.integer({signed: flags.eSigned}) + ")"; }
+ return "";
+ }
+ );
+
+ // real number RE
+ return (integerRE + decimalRE + exponentRE);
+}
+
+/**
+ Builds a regular expression to match a monetary value.
+
+ @param flags An object.
+ flags.signed The leading plus-or-minus sign. Can be true, false, or [true, false].
+ Default is [true, false], (i.e. will match if it is signed or unsigned).
+ flags.symbol A currency symbol such as Yen "�", Pound "�", or the Euro sign "�".
+ Default is "$". For more than one symbol use an array, e.g. ["$", ""], makes $ optional.
+ flags.placement The symbol can come "before" the number or "after". Default is "before".
+ flags.separator The character used as the thousands separator. The default is ",".
+ flags.cents The two decimal places for cents. Can be true, false, or [true, false].
+ Default is [true, false], (i.e. will match if cents are present are not).
+ flags.decimal A string for the character used as the decimal point. Default is ".".
+
+ @return A string for a regular expression for a monetary value.
+*/
+dojo.regexp.currency = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.signed == "undefined") { flags.signed = [true, false]; }
+ if (typeof flags.symbol == "undefined") { flags.symbol = "$"; }
+ if (typeof flags.placement != "string") { flags.placement = "before"; }
+ if (typeof flags.separator != "string") { flags.separator = ","; }
+ if (typeof flags.cents == "undefined") { flags.cents = [true, false]; }
+ if (typeof flags.decimal != "string") { flags.decimal = "."; }
+
+ // build sign RE
+ var signRE = dojo.regexp.buildGroupRE(flags.signed,
+ function(q) { if (q) { return "[-+]"; } return ""; }
+ );
+
+ // build symbol RE
+ var symbolRE = dojo.regexp.buildGroupRE(flags.symbol,
+ function(symbol) {
+ // escape all special characters
+ return "\\s?" + symbol.replace( /([.$?*!=:|\\\/^])/g, "\\$1") + "\\s?";
+ }
+ );
+
+ // number RE
+ var numberRE = dojo.regexp.integer( {signed: false, separator: flags.separator} );
+
+ // build cents RE
+ var centsRE = dojo.regexp.buildGroupRE(flags.cents,
+ function(q) { if (q) { return "(\\" + flags.decimal + "\\d\\d)"; } return ""; }
+ );
+
+ // build currency RE
+ var currencyRE;
+ if (flags.placement == "before") {
+ currencyRE = signRE + symbolRE + numberRE + centsRE;
+ }
+ else {
+ currencyRE = signRE + numberRE + centsRE + symbolRE;
+ }
+
+ return currencyRE;
+}
+
+/**
+ A regular expression to match US state and territory abbreviations.
+
+ @param flags An object.
+ flags.allowTerritories Allow Guam, Puerto Rico, etc. Default is true.
+ flags.allowMilitary Allow military 'states', e.g. Armed Forces Europe (AE). Default is true.
+
+ @return A string for a regular expression for a US state.
+*/
+dojo.regexp.us.state = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.allowTerritories != "boolean") { flags.allowTerritories = true; }
+ if (typeof flags.allowMilitary != "boolean") { flags.allowMilitary = true; }
+
+ // state RE
+ var statesRE =
+ "AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|" +
+ "NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY";
+
+ // territories RE
+ var territoriesRE = "AS|FM|GU|MH|MP|PW|PR|VI";
+
+ // military states RE
+ var militaryRE = "AA|AE|AP";
+
+ // Build states and territories RE
+ if (flags.allowTerritories) { statesRE += "|" + territoriesRE; }
+ if (flags.allowMilitary) { statesRE += "|" + militaryRE; }
+
+ return "(" + statesRE + ")";
+}
+
+/**
+ Builds a regular expression to match any International format for time.
+ The RE can match one format or one of multiple formats.
+
+ Format
+ h 12 hour, no zero padding.
+ hh 12 hour, has leading zero.
+ H 24 hour, no zero padding.
+ HH 24 hour, has leading zero.
+ m minutes, no zero padding.
+ mm minutes, has leading zero.
+ s seconds, no zero padding.
+ ss seconds, has leading zero.
+ t am or pm, case insensitive.
+ All other characters must appear literally in the expression.
+
+ Example
+ "h:m:s t" -> 2:5:33 PM
+ "HH:mm:ss" -> 14:05:33
+
+ @param flags An object.
+ flags.format A string or an array of strings. Default is "h:mm:ss t".
+ flags.amSymbol The symbol used for AM. Default is "AM".
+ flags.pmSymbol The symbol used for PM. Default is "PM".
+
+ @return A string for a regular expression for a time value.
+*/
+dojo.regexp.time = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.format == "undefined") { flags.format = "h:mm:ss t"; }
+ if (typeof flags.amSymbol != "string") { flags.amSymbol = "AM"; }
+ if (typeof flags.pmSymbol != "string") { flags.pmSymbol = "PM"; }
+
+ // Converts a time format to a RE
+ var timeRE = function(format) {
+ // escape all special characters
+ format = format.replace( /([.$?*!=:|{}\(\)\[\]\\\/^])/g, "\\$1");
+ var amRE = flags.amSymbol.replace( /([.$?*!=:|{}\(\)\[\]\\\/^])/g, "\\$1");
+ var pmRE = flags.pmSymbol.replace( /([.$?*!=:|{}\(\)\[\]\\\/^])/g, "\\$1");
+
+ // replace tokens with Regular Expressions
+ format = format.replace("hh", "(0[1-9]|1[0-2])");
+ format = format.replace("h", "([1-9]|1[0-2])");
+ format = format.replace("HH", "([01][0-9]|2[0-3])");
+ format = format.replace("H", "([0-9]|1[0-9]|2[0-3])");
+ format = format.replace("mm", "([0-5][0-9])");
+ format = format.replace("m", "([1-5][0-9]|[0-9])");
+ format = format.replace("ss", "([0-5][0-9])");
+ format = format.replace("s", "([1-5][0-9]|[0-9])");
+ format = format.replace("t", "\\s?(" + amRE + "|" + pmRE + ")\\s?" );
+
+ return format;
+ };
+
+ // build RE for multiple time formats
+ return dojo.regexp.buildGroupRE(flags.format, timeRE);
+}
+
+/**
+ Builds a regular expression to match any sort of number based format.
+ Use it for phone numbers, social security numbers, zip-codes, etc.
+ The RE can match one format or one of multiple formats.
+
+ Format
+ # Stands for a digit, 0-9.
+ ? Stands for an optional digit, 0-9 or nothing.
+ All other characters must appear literally in the expression.
+
+ Example
+ "(###) ###-####" -> (510) 542-9742
+ "(###) ###-#### x#???" -> (510) 542-9742 x153
+ "###-##-####" -> 506-82-1089 i.e. social security number
+ "#####-####" -> 98225-1649 i.e. zip code
+
+ @param flags An object.
+ flags.format A string or an Array of strings for multiple formats.
+ @return A string for a regular expression for the number format(s).
+*/
+dojo.regexp.numberFormat = function(flags) {
+ // assign default values to missing paramters
+ flags = (typeof flags == "object") ? flags : {};
+ if (typeof flags.format == "undefined") { flags.format = "###-###-####"; }
+
+ // Converts a number format to RE.
+ var digitRE = function(format) {
+ // escape all special characters, except '?'
+ format = format.replace( /([.$*!=:|{}\(\)\[\]\\\/^])/g, "\\$1");
+
+ // Now replace '?' with Regular Expression
+ format = format.replace(/\?/g, "\\d?");
+
+ // replace # with Regular Expression
+ format = format.replace(/#/g, "\\d");
+
+ return format;
+ };
+
+ // build RE for multiple number formats
+ return dojo.regexp.buildGroupRE(flags.format, digitRE);
+}
+
+
+/**
+ This is basically a utility function used by some of the RE generators.
+ Builds a regular expression that groups subexpressions.
+ The subexpressions are constructed by the function, re, in the second parameter.
+ re builds one subexpression for each elem in the array a, in the first parameter.
+
+ @param a A single value or an array of values.
+ @param re A function. Takes one parameter and converts it to a regular expression.
+ @return A string for a regular expression that groups all the subexpressions.
+*/
+dojo.regexp.buildGroupRE = function(a, re) {
+
+ // case 1: a is a single value.
+ if ( !( a instanceof Array ) ) {
+ return re(a);
+ }
+
+ // case 2: a is an array
+ var b = [];
+ for (var i = 0; i < a.length; i++) {
+ // convert each elem to a RE
+ b.push(re(a[i]));
+ }
+
+ // join the REs as alternatives in a RE group.
+ return "(" + b.join("|") + ")";
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/regexp.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/Deferred.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/Deferred.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/Deferred.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/Deferred.js Sat Jun 10 07:27:44 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.provide("dojo.rpc.Deferred");
+dojo.require("dojo.Deferred");
+
+dojo.rpc.Deferred = dojo.Deferred;
+dojo.rpc.Deferred.prototype = dojo.Deferred.prototype;
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/Deferred.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/JotService.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/JotService.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/JotService.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/JotService.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,41 @@
+/*
+ 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.rpc.JotService");
+dojo.require("dojo.rpc.RpcService");
+dojo.require("dojo.rpc.JsonService");
+dojo.require("dojo.json");
+
+dojo.rpc.JotService = function(){
+ this.serviceUrl = "/_/jsonrpc";
+}
+
+dojo.inherits(dojo.rpc.JotService, dojo.rpc.JsonService);
+
+dojo.lang.extend(dojo.rpc.JotService, {
+ bind: function(method, parameters, deferredRequestHandler, url){
+ dojo.io.bind({
+ url: url||this.serviceUrl,
+ content: {
+ json: this.createRequest(method, parameters)
+ },
+ method: "POST",
+ mimetype: "text/json",
+ load: this.resultCallback(deferredRequestHandler),
+ error: this.errorCallback(deferredRequestHandler),
+ preventCache: true
+ });
+ },
+
+ createRequest: function(method, params){
+ var req = { "params": params, "method": method, "id": this.lastSubmissionId++ };
+ return dojo.json.serialize(req);
+ }
+});
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/JotService.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/__package__.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/__package__.js?rev=413306&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/__package__.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/__package__.js Sat Jun 10 07:27:44 2006
@@ -0,0 +1,14 @@
+/*
+ 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.rpc.JsonService", false, false]
+});
+dojo.provide("dojo.rpc.*");
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/rpc/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native