You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/06/10 15:59:38 UTC
svn commit: r413300 [3/16] - in /tapestry/tapestry4/trunk/framework/src/js:
dojo/ dojo/src/ dojo/src/animation/ dojo/src/collections/ dojo/src/compat/
dojo/src/crypto/ dojo/src/data/ dojo/src/data/format/
dojo/src/data/provider/ dojo/src/debug/ dojo/sr...
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/dojo.js.uncompressed.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/flash6_gateway.swf
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/flash6_gateway.swf?rev=413300&view=auto
==============================================================================
Binary file - no diff available.
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/flash6_gateway.swf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/Deferred.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/Deferred.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/Deferred.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/Deferred.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,309 @@
+/*
+ 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.Deferred");
+dojo.require("dojo.lang.func");
+
+dojo.Deferred = function(/* optional */ canceller){
+ /*
+ NOTE: this namespace and documentation are imported wholesale
+ from MochiKit
+
+ Encapsulates a sequence of callbacks in response to a value that
+ may not yet be available. This is modeled after the Deferred class
+ from Twisted <http://twistedmatrix.com>.
+
+ Why do we want this? JavaScript has no threads, and even if it did,
+ threads are hard. Deferreds are a way of abstracting non-blocking
+ events, such as the final response to an XMLHttpRequest.
+
+ The sequence of callbacks is internally represented as a list
+ of 2-tuples containing the callback/errback pair. For example,
+ the following call sequence::
+
+ var d = new Deferred();
+ d.addCallback(myCallback);
+ d.addErrback(myErrback);
+ d.addBoth(myBoth);
+ d.addCallbacks(myCallback, myErrback);
+
+ is translated into a Deferred with the following internal
+ representation::
+
+ [
+ [myCallback, null],
+ [null, myErrback],
+ [myBoth, myBoth],
+ [myCallback, myErrback]
+ ]
+
+ The Deferred also keeps track of its current status (fired).
+ Its status may be one of three things:
+
+ -1: no value yet (initial condition)
+ 0: success
+ 1: error
+
+ A Deferred will be in the error state if one of the following
+ three conditions are met:
+
+ 1. The result given to callback or errback is "instanceof" Error
+ 2. The previous callback or errback raised an exception while
+ executing
+ 3. The previous callback or errback returned a value "instanceof"
+ Error
+
+ Otherwise, the Deferred will be in the success state. The state of
+ the Deferred determines the next element in the callback sequence to
+ run.
+
+ When a callback or errback occurs with the example deferred chain,
+ something equivalent to the following will happen (imagine that
+ exceptions are caught and returned)::
+
+ // d.callback(result) or d.errback(result)
+ if(!(result instanceof Error)){
+ result = myCallback(result);
+ }
+ if(result instanceof Error){
+ result = myErrback(result);
+ }
+ result = myBoth(result);
+ if(result instanceof Error){
+ result = myErrback(result);
+ }else{
+ result = myCallback(result);
+ }
+
+ The result is then stored away in case another step is added to the
+ callback sequence. Since the Deferred already has a value available,
+ any new callbacks added will be called immediately.
+
+ There are two other "advanced" details about this implementation that
+ are useful:
+
+ Callbacks are allowed to return Deferred instances themselves, so you
+ can build complicated sequences of events with ease.
+
+ The creator of the Deferred may specify a canceller. The canceller
+ is a function that will be called if Deferred.cancel is called before
+ the Deferred fires. You can use this to implement clean aborting of
+ an XMLHttpRequest, etc. Note that cancel will fire the deferred with
+ a CancelledError (unless your canceller returns another kind of
+ error), so the errbacks should be prepared to handle that error for
+ cancellable Deferreds.
+
+ */
+
+ this.chain = [];
+ this.id = this._nextId();
+ this.fired = -1;
+ this.paused = 0;
+ this.results = [null, null];
+ this.canceller = canceller;
+ this.silentlyCancelled = false;
+};
+
+dojo.lang.extend(dojo.Deferred, {
+ getFunctionFromArgs: function(){
+ var a = arguments;
+ if((a[0])&&(!a[1])){
+ if(dojo.lang.isFunction(a[0])){
+ return a[0];
+ }else if(dojo.lang.isString(a[0])){
+ return dj_global[a[0]];
+ }
+ }else if((a[0])&&(a[1])){
+ return dojo.lang.hitch(a[0], a[1]);
+ }
+ return null;
+ },
+
+ repr: function(){
+ var state;
+ if(this.fired == -1){
+ state = 'unfired';
+ }else if(this.fired == 0){
+ state = 'success';
+ } else {
+ state = 'error';
+ }
+ return 'Deferred(' + this.id + ', ' + state + ')';
+ },
+
+ toString: dojo.lang.forward("repr"),
+
+ _nextId: (function(){
+ var n = 1;
+ return function(){ return n++; };
+ })(),
+
+ cancel: function(){
+ /***
+ Cancels a Deferred that has not yet received a value, or is
+ waiting on another Deferred as its value.
+
+ If a canceller is defined, the canceller is called. If the
+ canceller did not return an error, or there was no canceller,
+ then the errback chain is started with CancelledError.
+ ***/
+ if(this.fired == -1){
+ if (this.canceller){
+ this.canceller(this);
+ }else{
+ this.silentlyCancelled = true;
+ }
+ if(this.fired == -1){
+ this.errback(new Error(this.repr()));
+ }
+ }else if( (this.fired == 0)&&
+ (this.results[0] instanceof dojo.Deferred)){
+ this.results[0].cancel();
+ }
+ },
+
+
+ _pause: function(){
+ // Used internally to signal that it's waiting on another Deferred
+ this.paused++;
+ },
+
+ _unpause: function(){
+ // Used internally to signal that it's no longer waiting on
+ // another Deferred.
+ this.paused--;
+ if ((this.paused == 0) && (this.fired >= 0)) {
+ this._fire();
+ }
+ },
+
+ _continue: function(res){
+ // Used internally when a dependent deferred fires.
+ this._resback(res);
+ this._unpause();
+ },
+
+ _resback: function(res){
+ // The primitive that means either callback or errback
+ this.fired = ((res instanceof Error) ? 1 : 0);
+ this.results[this.fired] = res;
+ this._fire();
+ },
+
+ _check: function(){
+ if(this.fired != -1){
+ if(!this.silentlyCancelled){
+ dojo.raise("already called!");
+ }
+ this.silentlyCancelled = false;
+ return;
+ }
+ },
+
+ callback: function(res){
+ /*
+ Begin the callback sequence with a non-error value.
+
+ callback or errback should only be called once on a given
+ Deferred.
+ */
+ this._check();
+ this._resback(res);
+ },
+
+ errback: function(res){
+ // Begin the callback sequence with an error result.
+ this._check();
+ if(!(res instanceof Error)){
+ res = new Error(res);
+ }
+ this._resback(res);
+ },
+
+ addBoth: function(cb, cbfn){
+ /*
+ Add the same function as both a callback and an errback as the
+ next element on the callback sequence. This is useful for code
+ that you want to guarantee to run, e.g. a finalizer.
+ */
+ var enclosed = this.getFunctionFromArgs(cb, cbfn);
+ if(arguments.length > 2){
+ enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2);
+ }
+ return this.addCallbacks(enclosed, enclosed);
+ },
+
+ addCallback: function(cb, cbfn){
+ // Add a single callback to the end of the callback sequence.
+ var enclosed = this.getFunctionFromArgs(cb, cbfn);
+ if(arguments.length > 2){
+ enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2);
+ }
+ return this.addCallbacks(enclosed, null);
+ },
+
+ addErrback: function(cb, cbfn){
+ // Add a single callback to the end of the callback sequence.
+ var enclosed = this.getFunctionFromArgs(cb, cbfn);
+ if(arguments.length > 2){
+ enclosed = dojo.lang.curryArguments(null, enclosed, arguments, 2);
+ }
+ return this.addCallbacks(null, enclosed);
+ return this.addCallbacks(null, cbfn);
+ },
+
+ addCallbacks: function (cb, eb) {
+ // Add separate callback and errback to the end of the callback
+ // sequence.
+ this.chain.push([cb, eb])
+ if (this.fired >= 0) {
+ this._fire();
+ }
+ return this;
+ },
+
+ _fire: function(){
+ // Used internally to exhaust the callback sequence when a result
+ // is available.
+ var chain = this.chain;
+ var fired = this.fired;
+ var res = this.results[fired];
+ var self = this;
+ var cb = null;
+ while (chain.length > 0 && this.paused == 0) {
+ // Array
+ var pair = chain.shift();
+ var f = pair[fired];
+ if (f == null) {
+ continue;
+ }
+ try {
+ res = f(res);
+ fired = ((res instanceof Error) ? 1 : 0);
+ if(res instanceof dojo.Deferred) {
+ cb = function(res){
+ self._continue(res);
+ }
+ this._pause();
+ }
+ }catch(err){
+ fired = 1;
+ res = err;
+ }
+ }
+ this.fired = fired;
+ this.results[fired] = res;
+ if((cb)&&(this.paused)){
+ // this is for "tail recursion" in case the dependent
+ // deferred is already fired
+ res.addBoth(cb);
+ }
+ }
+});
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/Deferred.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Animation.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Animation.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Animation.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Animation.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,217 @@
+/*
+ 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.animation.Animation");
+dojo.require("dojo.animation.AnimationEvent");
+
+dojo.require("dojo.lang.func");
+dojo.require("dojo.math");
+dojo.require("dojo.math.curves");
+
+/*
+Animation package based off of Dan Pupius' work on Animations:
+http://pupius.co.uk/js/Toolkit.Drawing.js
+*/
+
+dojo.animation.Animation = function(/*dojo.math.curves.Line*/ curve, /*int*/ duration, /*Decimal?*/ accel, /*int?*/ repeatCount, /*int?*/ rate) {
+ // public properties
+ if(dojo.lang.isArray(curve)) {
+ // curve: Array
+ // id: i
+ curve = new dojo.math.curves.Line(curve[0], curve[1]);
+ }
+ this.curve = curve;
+ this.duration = duration;
+ this.repeatCount = repeatCount || 0;
+ this.rate = rate || 25;
+ if(accel) {
+ // accel: Decimal
+ // id: j
+ if(dojo.lang.isFunction(accel.getValue)) {
+ // accel: dojo.math.curves.CatmullRom
+ // id: k
+ this.accel = accel;
+ } else {
+ var i = 0.35*accel+0.5; // 0.15 <= i <= 0.85
+ this.accel = new dojo.math.curves.CatmullRom([[0], [i], [1]], 0.45);
+ }
+ }
+}
+
+dojo.lang.extend(dojo.animation.Animation, {
+ // public properties
+ curve: null,
+ duration: 0,
+ repeatCount: 0,
+ accel: null,
+
+ // events
+ onBegin: null,
+ onAnimate: null,
+ onEnd: null,
+ onPlay: null,
+ onPause: null,
+ onStop: null,
+ handler: null,
+
+ // "private" properties
+ _animSequence: null,
+ _startTime: null,
+ _endTime: null,
+ _lastFrame: null,
+ _timer: null,
+ _percent: 0,
+ _active: false,
+ _paused: false,
+ _startRepeatCount: 0,
+
+ // public methods
+ play: function(gotoStart) {
+ if( gotoStart ) {
+ clearTimeout(this._timer);
+ this._active = false;
+ this._paused = false;
+ this._percent = 0;
+ } else if( this._active && !this._paused ) {
+ return;
+ }
+
+ this._startTime = new Date().valueOf();
+ if( this._paused ) {
+ this._startTime -= (this.duration * this._percent / 100);
+ }
+ this._endTime = this._startTime + this.duration;
+ this._lastFrame = this._startTime;
+
+ var e = new dojo.animation.AnimationEvent(this, null, this.curve.getValue(this._percent),
+ this._startTime, this._startTime, this._endTime, this.duration, this._percent, 0);
+
+ this._active = true;
+ this._paused = false;
+
+ if( this._percent == 0 ) {
+ if(!this._startRepeatCount) {
+ this._startRepeatCount = this.repeatCount;
+ }
+ e.type = "begin";
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onBegin == "function") { this.onBegin(e); }
+ }
+
+ e.type = "play";
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onPlay == "function") { this.onPlay(e); }
+
+ if(this._animSequence) { this._animSequence._setCurrent(this); }
+
+ this._cycle();
+ },
+
+ pause: function() {
+ clearTimeout(this._timer);
+ if( !this._active ) { return; }
+ this._paused = true;
+ var e = new dojo.animation.AnimationEvent(this, "pause", this.curve.getValue(this._percent),
+ this._startTime, new Date().valueOf(), this._endTime, this.duration, this._percent, 0);
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onPause == "function") { this.onPause(e); }
+ },
+
+ playPause: function() {
+ if( !this._active || this._paused ) {
+ this.play();
+ } else {
+ this.pause();
+ }
+ },
+
+ 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 e = new dojo.animation.AnimationEvent(this, "stop", this.curve.getValue(step),
+ this._startTime, new Date().valueOf(), this._endTime, this.duration, this._percent);
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onStop == "function") { this.onStop(e); }
+ 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);
+ var fps = 1000 / (curr - this._lastFrame);
+ this._lastFrame = curr;
+
+ if( step >= 1 ) {
+ step = 1;
+ this._percent = 100;
+ } else {
+ this._percent = step * 100;
+ }
+
+ // Perform accelleration
+ if(this.accel && this.accel.getValue) {
+ step = this.accel.getValue(step);
+ }
+
+ var e = new dojo.animation.AnimationEvent(this, "animate", this.curve.getValue(step),
+ this._startTime, curr, this._endTime, this.duration, this._percent, Math.round(fps));
+
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onAnimate == "function") { this.onAnimate(e); }
+
+ if( step < 1 ) {
+ this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate);
+ } else {
+ e.type = "end";
+ this._active = false;
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onEnd == "function") { this.onEnd(e); }
+
+ if( this.repeatCount > 0 ) {
+ this.repeatCount--;
+ this.play(true);
+ } else if( this.repeatCount == -1 ) {
+ this.play(true);
+ } else {
+ if(this._startRepeatCount) {
+ this.repeatCount = this._startRepeatCount;
+ this._startRepeatCount = 0;
+ }
+ if( this._animSequence ) {
+ this._animSequence._playNext();
+ }
+ }
+ }
+ }
+ }
+});
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Animation.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/AnimationSequence.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/AnimationSequence.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/AnimationSequence.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/AnimationSequence.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,136 @@
+/*
+ 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.animation.AnimationSequence");
+dojo.require("dojo.animation.AnimationEvent");
+dojo.require("dojo.animation.Animation");
+
+dojo.animation.AnimationSequence = function(repeatCount){
+ this._anims = [];
+ this.repeatCount = repeatCount || 0;
+}
+
+dojo.lang.extend(dojo.animation.AnimationSequence, {
+ repeateCount: 0,
+
+ _anims: [],
+ _currAnim: -1,
+
+ onBegin: null,
+ onEnd: null,
+ onNext: null,
+ handler: null,
+
+ add: function() {
+ for(var i = 0; i < arguments.length; i++) {
+ this._anims.push(arguments[i]);
+ arguments[i]._animSequence = this;
+ }
+ },
+
+ remove: function(anim) {
+ for(var i = 0; i < this._anims.length; i++) {
+ if( this._anims[i] == anim ) {
+ this._anims[i]._animSequence = null;
+ this._anims.splice(i, 1);
+ break;
+ }
+ }
+ },
+
+ removeAll: function() {
+ for(var i = 0; i < this._anims.length; i++) {
+ this._anims[i]._animSequence = null;
+ }
+ this._anims = [];
+ this._currAnim = -1;
+ },
+
+ clear: function() {
+ this.removeAll();
+ },
+
+ play: function(gotoStart) {
+ if( this._anims.length == 0 ) { return; }
+ if( gotoStart || !this._anims[this._currAnim] ) {
+ this._currAnim = 0;
+ }
+ if( this._anims[this._currAnim] ) {
+ if( this._currAnim == 0 ) {
+ var e = {type: "begin", animation: this._anims[this._currAnim]};
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onBegin == "function") { this.onBegin(e); }
+ }
+ this._anims[this._currAnim].play(gotoStart);
+ }
+ },
+
+ pause: function() {
+ if( this._anims[this._currAnim] ) {
+ this._anims[this._currAnim].pause();
+ }
+ },
+
+ playPause: function() {
+ if( this._anims.length == 0 ) { return; }
+ if( this._currAnim == -1 ) { this._currAnim = 0; }
+ if( this._anims[this._currAnim] ) {
+ this._anims[this._currAnim].playPause();
+ }
+ },
+
+ stop: function() {
+ if( this._anims[this._currAnim] ) {
+ this._anims[this._currAnim].stop();
+ }
+ },
+
+ status: function() {
+ if( this._anims[this._currAnim] ) {
+ return this._anims[this._currAnim].status();
+ } else {
+ return "stopped";
+ }
+ },
+
+ _setCurrent: function(anim) {
+ for(var i = 0; i < this._anims.length; i++) {
+ if( this._anims[i] == anim ) {
+ this._currAnim = i;
+ break;
+ }
+ }
+ },
+
+ _playNext: function() {
+ if( this._currAnim == -1 || this._anims.length == 0 ) { return; }
+ this._currAnim++;
+ if( this._anims[this._currAnim] ) {
+ var e = {type: "next", animation: this._anims[this._currAnim]};
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onNext == "function") { this.onNext(e); }
+ this._anims[this._currAnim].play(true);
+ } else {
+ var e = {type: "end", animation: this._anims[this._anims.length-1]};
+ if(typeof this.handler == "function") { this.handler(e); }
+ if(typeof this.onEnd == "function") { this.onEnd(e); }
+ if(this.repeatCount > 0) {
+ this._currAnim = 0;
+ this.repeatCount--;
+ this._anims[this._currAnim].play(true);
+ } else if(this.repeatCount == -1) {
+ this._currAnim = 0;
+ this._anims[this._currAnim].play(true);
+ } else {
+ this._currAnim = -1;
+ }
+ }
+ }
+});
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/AnimationSequence.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Timer.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Timer.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Timer.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Timer.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,39 @@
+/*
+ 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.animation.Timer");
+dojo.require("dojo.lang.func");
+
+dojo.animation.Timer = function(intvl){
+ var timer = null;
+ this.isRunning = false;
+ this.interval = intvl;
+
+ this.onTick = function(){};
+ this.onStart = null;
+ this.onStop = null;
+
+ this.setInterval = function(ms){
+ if (this.isRunning) window.clearInterval(timer);
+ this.interval = ms;
+ if (this.isRunning) timer = window.setInterval(dojo.lang.hitch(this, "onTick"), this.interval);
+ };
+
+ this.start = function(){
+ if (typeof this.onStart == "function") this.onStart();
+ this.isRunning = true;
+ timer = window.setInterval(this.onTick, this.interval);
+ };
+ this.stop = function(){
+ if (typeof this.onStop == "function") this.onStop();
+ this.isRunning = false;
+ window.clearInterval(timer);
+ };
+};
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/Timer.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/__package__.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/__package__.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/__package__.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/__package__.js Sat Jun 10 06:59:28 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.animation.AnimationEvent",
+ "dojo.animation.Animation",
+ "dojo.animation.AnimationSequence"
+ ]
+});
+dojo.provide("dojo.animation.*");
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/animation/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/bootstrap1.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/bootstrap1.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/bootstrap1.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/bootstrap1.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,339 @@
+/**
+* @file bootstrap1.js
+*
+* summary: First file that is loaded that 'bootstraps' the entire dojo library suite.
+* note: Must run before hostenv_*.js file.
+*
+* @author Copyright 2004 Mark D. Anderson (mda@discerning.com)
+* TODOC: should the copyright be changed to Dojo Foundation?
+* @license Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php
+*
+* $Id: bootstrap1.js 4189 2006-05-26 19:29:18Z alex $
+*/
+
+// TODOC: HOW TO DOC THE BELOW?
+// @global: djConfig
+// summary:
+// Application code can set the global 'djConfig' prior to loading
+// the library to override certain global settings for how dojo works.
+// description: The variables that can be set are as follows:
+// - isDebug: false
+// - allowQueryConfig: false
+// - baseScriptUri: ""
+// - baseRelativePath: ""
+// - libraryScriptUri: ""
+// - iePreventClobber: false
+// - ieClobberMinimal: true
+// - preventBackButtonFix: true
+// - searchIds: []
+// - parseWidgets: true
+// TODOC: HOW TO DOC THESE VARIABLES?
+// TODOC: IS THIS A COMPLETE LIST?
+// note:
+// 'djConfig' does not exist under 'dojo.*' so that it can be set before the
+// 'dojo' variable exists.
+// note:
+// Setting any of these variables *after* the library has loaded does nothing at all.
+// TODOC: is this still true? Release notes for 0.3 indicated they could be set after load.
+//
+
+
+
+//TODOC: HOW TO DOC THIS?
+// @global: dj_global
+// summary:
+// an alias for the top-level global object in the host environment
+// (e.g., the window object in a browser).
+// description:
+// Refer to 'dj_global' rather than referring to window to ensure your
+// code runs correctly in contexts other than web browsers (eg: Rhino on a server).
+var dj_global = this;
+
+
+
+function dj_undef(/*String*/ name, /*Object?*/ object){
+ //summary: Returns true if 'name' is defined on 'object' (or globally if 'object' is null).
+ //description: Note that 'defined' and 'exists' are not the same concept.
+ if(object==null){ object = dj_global; }
+ // exception if object is not an Object
+ return (typeof object[name] == "undefined"); // Boolean
+}
+
+
+// make sure djConfig is defined
+if(dj_undef("djConfig")){
+ var djConfig = {};
+}
+
+
+//TODOC: HOW TO DOC THIS?
+// dojo is the root variable of (almost all) our public symbols -- make sure it is defined.
+if(dj_undef("dojo")){
+ var dojo = {};
+}
+
+//TODOC: HOW TO DOC THIS?
+dojo.version = {
+ // summary: version number of this instance of dojo.
+ major: 0, minor: 3, patch: 0, flag: "+",
+ revision: Number("$Rev: 4189 $".match(/[0-9]+/)[0]),
+ toString: function(){
+ with(dojo.version){
+ return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String
+ }
+ }
+}
+
+dojo.evalProp = function(/*String*/ name, /*Object*/ object, /*Boolean?*/ create){
+ // summary: Returns 'object[name]'. If not defined and 'create' is true, will return a new Object.
+ // description:
+ // Returns null if 'object[name]' is not defined and 'create' is not true.
+ // Note: 'defined' and 'exists' are not the same concept.
+ return (object && !dj_undef(name, object) ? object[name] : (create ? (object[name]={}) : undefined)); // mixed
+}
+
+
+dojo.parseObjPath = function(/*String*/ path, /*Object?*/ context, /*Boolean?*/ create){
+ // summary: Parse string path to an object, and return corresponding object reference and property name.
+ // description:
+ // Returns an object with two properties, 'obj' and 'prop'.
+ // 'obj[prop]' is the reference indicated by 'path'.
+ // path: Path to an object, in the form "A.B.C".
+ // context: Object to use as root of path. Defaults to 'dj_global'.
+ // create: If true, Objects will be created at any point along the 'path' that is undefined.
+ var object = (context != null ? context : dj_global);
+ var names = path.split('.');
+ var prop = names.pop();
+ for (var i=0,l=names.length;i<l && object;i++){
+ object = dojo.evalProp(names[i], object, create);
+ }
+ return {obj: object, prop: prop}; // Object: {obj: Object, prop: String}
+}
+
+
+dojo.evalObjPath = function(/*String*/ path, /*Boolean?*/ create){
+ // summary: Return the value of object at 'path' in the global scope, without using 'eval()'.
+ // path: Path to an object, in the form "A.B.C".
+ // create: If true, Objects will be created at any point along the 'path' that is undefined.
+ if(typeof path != "string"){
+ return dj_global;
+ }
+ // fast path for no periods
+ if(path.indexOf('.') == -1){
+ return dojo.evalProp(path, dj_global, create); // mixed
+ }
+
+ //MOW: old 'with' syntax was confusing and would throw an error if parseObjPath returned null.
+ var ref = dojo.parseObjPath(path, dj_global, create);
+ if(ref){
+ return dojo.evalProp(ref.prop, ref.obj, create); // mixed
+ }
+ return null;
+}
+
+// ****************************************************************
+// global public utils
+// TODOC: DO WE WANT TO NOTE THAT THESE ARE GLOBAL PUBLIC UTILS?
+// ****************************************************************
+
+dojo.errorToString = function(/*Error*/ exception){
+ // summary: Return an exception's 'message', 'description' or text.
+
+ // TODO: overriding Error.prototype.toString won't accomplish this?
+ // ... since natively generated Error objects do not always reflect such things?
+ if(!dj_undef("message", exception)){
+ return exception.message; // String
+ }else if(!dj_undef("description", exception)){
+ return exception.description; // String
+ }else{
+ return exception; // Error
+ }
+}
+
+
+dojo.raise = function(/*String*/ message, /*Error?*/ exception){
+ // summary: Throw an error message, appending text of 'exception' if provided.
+ // note: Also prints a message to the user using 'dojo.hostenv.println'.
+ if(exception){
+ message = message + ": "+dojo.errorToString(exception);
+ }
+
+ // print the message to the user if hostenv.println is defined
+ try { dojo.hostenv.println("FATAL: "+message); } catch (e) {}
+
+ throw Error(message);
+}
+
+//Stub functions so things don't break.
+//TODOC: HOW TO DOC THESE?
+dojo.debug = function(){}
+dojo.debugShallow = function(obj){}
+dojo.profile = { start: function(){}, end: function(){}, stop: function(){}, dump: function(){} };
+
+
+function dj_eval(/*String*/ scriptFragment){
+ // summary: Perform an evaluation in the global scope. Use this rather than calling 'eval()' directly.
+ // description: Placed in a separate function to minimize size of trapped evaluation context.
+ // note:
+ // - JSC eval() takes an optional second argument which can be 'unsafe'.
+ // - Mozilla/SpiderMonkey eval() takes an optional second argument which is the
+ // scope object for new symbols.
+ return dj_global.eval ? dj_global.eval(scriptFragment) : eval(scriptFragment); // mixed
+}
+
+
+
+dojo.unimplemented = function(/*String*/ funcname, /*String?*/ extra){
+ // summary: Throw an exception because some function is not implemented.
+ // extra: Text to append to the exception message.
+ var message = "'" + funcname + "' not implemented";
+ if (extra != null) { message += " " + extra; }
+ dojo.raise(message);
+}
+
+
+dojo.deprecated = function(/*String*/ behaviour, /*String?*/ extra, /*String?*/ removal){
+ // summary: Log a debug message to indicate that a behavior has been deprecated.
+ // extra: Text to append to the message.
+ // removal: Text to indicate when in the future the behavior will be removed.
+ var message = "DEPRECATED: " + behaviour;
+ if(extra){ message += " " + extra; }
+ if(removal){ message += " -- will be removed in version: " + removal; }
+ dojo.debug(message);
+}
+
+
+
+dojo.inherits = function(/*Function*/ subclass, /*Function*/ superclass){
+ // summary: Set up inheritance between two classes.
+ if(typeof superclass != 'function'){
+ dojo.raise("dojo.inherits: superclass argument ["+superclass+"] must be a function (subclass: [" + subclass + "']");
+ }
+ subclass.prototype = new superclass();
+ subclass.prototype.constructor = subclass;
+ subclass.superclass = superclass.prototype;
+ // DEPRICATED: super is a reserved word, use 'superclass'
+ subclass['super'] = superclass.prototype;
+}
+
+dojo.render = (function(){
+ //TODOC: HOW TO DOC THIS?
+ // summary: Details rendering support, OS and browser of the current environment.
+ // TODOC: is this something many folks will interact with? If so, we should doc the structure created...
+ function vscaffold(prefs, names){
+ var tmp = {
+ capable: false,
+ support: {
+ builtin: false,
+ plugin: false
+ },
+ prefixes: prefs
+ };
+ for(var prop in names){
+ tmp[prop] = false;
+ }
+ return tmp;
+ }
+
+ return {
+ name: "",
+ ver: dojo.version,
+ os: { win: false, linux: false, osx: false },
+ html: vscaffold(["html"], ["ie", "opera", "khtml", "safari", "moz"]),
+ svg: vscaffold(["svg"], ["corel", "adobe", "batik"]),
+ vml: vscaffold(["vml"], ["ie"]),
+ swf: vscaffold(["Swf", "Flash", "Mm"], ["mm"]),
+ swt: vscaffold(["Swt"], ["ibm"])
+ };
+})();
+
+// ****************************************************************
+// dojo.hostenv methods that must be defined in hostenv_*.js
+// ****************************************************************
+
+/**
+ * The interface definining the interaction with the EcmaScript host environment.
+*/
+
+/*
+ * None of these methods should ever be called directly by library users.
+ * Instead public methods such as loadModule should be called instead.
+ */
+dojo.hostenv = (function(){
+ // TODOC: HOW TO DOC THIS?
+ // summary: Provides encapsulation of behavior that changes across different 'host environments'
+ // (different browsers, server via Rhino, etc).
+ // description: None of these methods should ever be called directly by library users.
+ // Use public methods such as 'loadModule' instead.
+
+ // default configuration options
+ var config = {
+ isDebug: false,
+ allowQueryConfig: false,
+ baseScriptUri: "",
+ baseRelativePath: "",
+ libraryScriptUri: "",
+ iePreventClobber: false,
+ ieClobberMinimal: true,
+ preventBackButtonFix: true,
+ searchIds: [],
+ parseWidgets: true
+ };
+
+ if (typeof djConfig == "undefined") { djConfig = config; }
+ else {
+ for (var option in config) {
+ if (typeof djConfig[option] == "undefined") {
+ djConfig[option] = config[option];
+ }
+ }
+ }
+
+ return {
+ name_: '(unset)',
+ version_: '(unset)',
+
+
+ getName: function(){
+ // sumary: Return the name of the host environment.
+ return this.name_; // String
+ },
+
+
+ getVersion: function(){
+ // summary: Return the version of the hostenv.
+ return this.version_; // String
+ },
+
+ getText: function(/*String*/ uri){
+ // summary: Read the plain/text contents at the specified 'uri'.
+ // description:
+ // If 'getText()' is not implemented, then it is necessary to override
+ // 'loadUri()' with an implementation that doesn't rely on it.
+
+ dojo.unimplemented('getText', "uri=" + uri);
+ }
+ };
+})();
+
+
+dojo.hostenv.getBaseScriptUri = function(){
+ // summary: Return the base script uri that other scripts are found relative to.
+ // TODOC: HUH? This comment means nothing to me. What other scripts? Is this the path to other dojo libraries?
+ // MAYBE: Return the base uri to scripts in the dojo library. ???
+ // return: Empty string or a path ending in '/'.
+ if(djConfig.baseScriptUri.length){
+ return djConfig.baseScriptUri;
+ }
+
+ // MOW: Why not:
+ // uri = djConfig.libraryScriptUri || djConfig.baseRelativePath
+ // ??? Why 'new String(...)'
+ var uri = new String(djConfig.libraryScriptUri||djConfig.baseRelativePath);
+ if (!uri) { dojo.raise("Nothing returned by getLibraryScriptUri(): " + uri); }
+
+ // MOW: uri seems to not be actually used. Seems to be hard-coding to djConfig.baseRelativePath... ???
+ var lastslash = uri.lastIndexOf('/'); // MOW ???
+ djConfig.baseScriptUri = djConfig.baseRelativePath;
+ return djConfig.baseScriptUri; // String
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/bootstrap1.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/browser_debug.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/browser_debug.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/browser_debug.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/browser_debug.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,162 @@
+/*
+ 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.hostenv.loadedUris.push("../src/bootstrap1.js");
+dojo.hostenv.loadedUris.push("../src/loader.js");
+dojo.hostenv.loadedUris.push("../src/hostenv_browser.js");
+dojo.hostenv.loadedUris.push("../src/bootstrap2.js");
+
+function removeComments(contents){
+ contents = new String((!contents) ? "" : contents);
+ // clobber all comments
+ contents = contents.replace( /^(.*?)\/\/(.*)$/mg , "$1");
+ contents = contents.replace( /(\n)/mg , "__DOJONEWLINE");
+ contents = contents.replace( /\/\*(.*?)\*\//g , "");
+ return contents.replace( /__DOJONEWLINE/mg , "\n");
+}
+
+dojo.hostenv.getRequiresAndProvides = function(contents){
+ // FIXME: should probably memoize this!
+ if(!contents){ return []; }
+
+
+ // check to see if we need to load anything else first. Ugg.
+ var deps = [];
+ var tmp;
+ RegExp.lastIndex = 0;
+ var testExp = /dojo.(hostenv.loadModule|hosetnv.require|require|requireIf|kwCompoundRequire|hostenv.conditionalLoadModule|hostenv.startPackage|provide)\([\w\W]*?\)/mg;
+ while((tmp = testExp.exec(contents)) != null){
+ deps.push(tmp[0]);
+ }
+ return deps;
+}
+
+dojo.hostenv.getDelayRequiresAndProvides = function(contents){
+ // FIXME: should probably memoize this!
+ if(!contents){ return []; }
+
+ // check to see if we need to load anything else first. Ugg.
+ var deps = [];
+ var tmp;
+ RegExp.lastIndex = 0;
+ var testExp = /dojo.(requireAfterIf)\([\w\W]*?\)/mg;
+ while((tmp = testExp.exec(contents)) != null){
+ deps.push(tmp[0]);
+ }
+ return deps;
+}
+
+/*
+dojo.getNonExistantDescendants = function(objpath){
+ var ret = [];
+ // fast path for no periods
+ if(typeof objpath != "string"){ return dj_global; }
+ if(objpath.indexOf('.') == -1){
+ if(dj_undef(objpath, dj_global)){
+ ret.push[objpath];
+ }
+ return ret;
+ }
+
+ var syms = objpath.split(/\./);
+ var obj = dj_global;
+ for(var i=0;i<syms.length;++i){
+ if(dj_undef(syms[i], obj)){
+ for(var j=i; j<syms.length; j++){
+ ret.push(syms.slice(0, j+1).join("."));
+ }
+ break;
+ }
+ }
+ return ret;
+}
+*/
+
+dojo.clobberLastObject = function(objpath){
+ if(objpath.indexOf('.') == -1){
+ if(!dj_undef(objpath, dj_global)){
+ delete dj_global[objpath];
+ }
+ return true;
+ }
+
+ var syms = objpath.split(/\./);
+ var base = dojo.evalObjPath(syms.slice(0, -1).join("."), false);
+ var child = syms[syms.length-1];
+ if(!dj_undef(child, base)){
+ // alert(objpath);
+ delete base[child];
+ return true;
+ }
+ return false;
+}
+
+var removals = [];
+
+function zip(arr){
+ var ret = [];
+ var seen = {};
+ for(var x=0; x<arr.length; x++){
+ if(!seen[arr[x]]){
+ ret.push(arr[x]);
+ seen[arr[x]] = true;
+ }
+ }
+ return ret;
+}
+
+// over-write dj_eval to prevent actual loading of subsequent files
+var old_dj_eval = dj_eval;
+dj_eval = function(){ return true; }
+dojo.hostenv.oldLoadUri = dojo.hostenv.loadUri;
+dojo.hostenv.loadUri = function(uri){
+ if(dojo.hostenv.loadedUris[uri]){
+ return true; // fixes endless recursion opera trac 471
+ }
+ try{
+ var text = this.getText(uri, null, true);
+ var requires = dojo.hostenv.getRequiresAndProvides(text);
+ eval(requires.join(";"));
+ dojo.hostenv.loadedUris.push(uri);
+ dojo.hostenv.loadedUris[uri] = true;
+ var delayRequires = dojo.hostenv.getDelayRequiresAndProvides(text);
+ eval(delayRequires.join(";"));
+ }catch(e){
+ alert(e);
+ }
+ return true;
+}
+
+dojo.hostenv.writeIncludes = function(){
+ for(var x=removals.length-1; x>=0; x--){
+ dojo.clobberLastObject(removals[x]);
+ }
+ var depList = [];
+ var seen = {};
+ for(var x=0; x<dojo.hostenv.loadedUris.length; x++){
+ var curi = dojo.hostenv.loadedUris[x];
+ // dojo.debug(curi);
+ if(!seen[curi]){
+ seen[curi] = true;
+ depList.push(curi);
+ }
+ }
+
+ dojo.hostenv._global_omit_module_check = true;
+ for(var x=4; x<depList.length; x++){
+ document.write("<script type='text/javascript' src='"+depList[x]+"'></script>");
+ }
+ document.write("<script type='text/javascript'>dojo.hostenv._global_omit_module_check = false;</script>");
+
+ // turn off debugAtAllCosts, so that dojo.require() calls inside of ContentPane hrefs
+ // work correctly
+ dj_eval = old_dj_eval;
+ dojo.hostenv.loadUri = dojo.hostenv.oldLoadUri;
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/browser_debug.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/SortedList.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/SortedList.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/SortedList.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/SortedList.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,211 @@
+/*
+ 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.collections.SortedList");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.SortedList=function(/* object? */ dictionary){
+ // summary
+ // creates a collection that acts like a dictionary but is also internally sorted.
+ // Note that the act of adding any elements forces an internal resort, making this object potentially slow.
+ var _this=this;
+ var items={};
+ var q=[];
+ var sorter=function(a,b){
+ if (a.key > b.key) return 1;
+ if (a.key < b.key) return -1;
+ return 0;
+ };
+ var build=function(){
+ q=[];
+ var e=_this.getIterator();
+ while (!e.atEnd()){
+ q.push(e.get());
+ }
+ q.sort(sorter);
+ };
+ var testObject={};
+
+ this.count=q.length;
+ this.add=function(/* string */ k,/* object */v){
+ // summary
+ // add the passed value to the dictionary at location k
+ if (!items[k]) {
+ items[k]=new dojo.collections.DictionaryEntry(k,v);
+ this.count=q.push(items[k]);
+ q.sort(sorter);
+ }
+ };
+ this.clear=function(){
+ // summary
+ // clear the internal collections
+ items={};
+ q=[];
+ this.count=q.length;
+ };
+ this.clone=function(){
+ // summary
+ // create a clone of this sorted list
+ return new dojo.collections.SortedList(this); // dojo.collections.SortedList
+ };
+ this.contains=this.containsKey=function(/* string */ k){
+ // summary
+ // Check to see if the list has a location k
+ if(testObject[k]){
+ return false; // bool
+ }
+ return (items[k]!=null); // bool
+ };
+ this.containsValue=function(/* object */ o){
+ // summary
+ // Check to see if this list contains the passed object
+ var e=this.getIterator();
+ while (!e.atEnd()){
+ var item=e.get();
+ if(item.value==o){
+ return true; // bool
+ }
+ }
+ return false; // bool
+ };
+ this.copyTo=function(/* array */ arr, /* int */ i){
+ // summary
+ // copy the contents of the list into array arr at index i
+ var e=this.getIterator();
+ var idx=i;
+ while(!e.atEnd()){
+ arr.splice(idx,0,e.get());
+ idx++;
+ }
+ };
+ this.entry=function(/* string */ k){
+ // summary
+ // return the object at location k
+ return items[k]; // dojo.collections.DictionaryEntry
+ };
+ this.forEach=function(/* function */ fn, /* object? */ scope){
+ // summary
+ // functional iterator, following the mozilla spec.
+ var s=scope||dj_global;
+ if(Array.forEach){
+ Array.forEach(q, fn, s);
+ }else{
+ for(var i=0; i<q.length; i++){
+ fn.call(s, q[i], i, q);
+ }
+ }
+ };
+ this.getByIndex=function(/* int */ i){
+ // summary
+ // return the item at index i
+ return q[i].valueOf(); // object
+ };
+ this.getIterator=function(){
+ // summary
+ // get an iterator for this object
+ return new dojo.collections.DictionaryIterator(items); // dojo.collections.DictionaryIterator
+ };
+ this.getKey=function(/* int */ i){
+ // summary
+ // return the key of the item at index i
+ return q[i].key;
+ };
+ this.getKeyList=function(){
+ // summary
+ // return an array of the keys set in this list
+ var arr=[];
+ var e=this.getIterator();
+ while (!e.atEnd()){
+ arr.push(e.get().key);
+ }
+ return arr; // array
+ };
+ this.getValueList=function(){
+ // summary
+ // return an array of values in this list
+ var arr=[];
+ var e=this.getIterator();
+ while (!e.atEnd()){
+ arr.push(e.get().value);
+ }
+ return arr; // array
+ };
+ this.indexOfKey=function(/* string */ k){
+ // summary
+ // return the index of the passed key.
+ for (var i=0; i<q.length; i++){
+ if (q[i].key==k){
+ return i; // int
+ }
+ }
+ return -1; // int
+ };
+ this.indexOfValue=function(/* object */ o){
+ // summary
+ // return the first index of object o
+ for (var i=0; i<q.length; i++){
+ if (q[i].value==o){
+ return i; // int
+ }
+ }
+ return -1; // int
+ };
+ this.item=function(/* string */ k){
+ // summary
+ // return the value of the object at location k.
+ if(k in items && !testObject[k]){
+ return items[k].valueOf(); // object
+ }
+ return undefined; // object
+ };
+ this.remove=function(/* string */k){
+ // summary
+ // remove the item at location k and rebuild the internal collections.
+ delete items[k];
+ build();
+ this.count=q.length;
+ };
+ this.removeAt=function(/* int */ i){
+ // summary
+ // remove the item at index i, and rebuild the internal collections.
+ delete items[q[i].key];
+ build();
+ this.count=q.length;
+ };
+ this.replace=function(/* string */ k, /* object */ v){
+ // summary
+ // Replace an existing item if it's there, and add a new one if not.
+ if (!items[k]){
+ // we're adding a new object, return false
+ this.add(k,v);
+ return false; // bool
+ }else{
+ // we're replacing an object, return true
+ items[k]=new dojo.collections.DictionaryEntry(k,v);
+ q.sort(sorter);
+ return true; // bool
+ }
+ };
+ this.setByIndex=function(/* int */ i, /* object */ o){
+ // summary
+ // set an item by index
+ items[q[i].key].value=o;
+ build();
+ this.count=q.length;
+ };
+ if (dictionary){
+ var e=dictionary.getIterator();
+ while (!e.atEnd()){
+ var item=e.get();
+ q[q.length]=items[item.key]=new dojo.collections.DictionaryEntry(item.key,item.value);
+ }
+ q.sort(sorter);
+ }
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/SortedList.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/Stack.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/Stack.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/Stack.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/Stack.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,85 @@
+/*
+ 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.collections.Stack");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.Stack=function(/* array? */arr){
+ // summary
+ // returns an object of type dojo.collections.Stack
+ var q=[];
+ if (arr) q=q.concat(arr);
+ this.count=q.length;
+ this.clear=function(){
+ // summary
+ // Clear the internal array and reset the count
+ q=[];
+ this.count=q.length;
+ };
+ this.clone=function(){
+ // summary
+ // Create and return a clone of this Stack
+ return new dojo.collections.Stack(q);
+ };
+ this.contains=function(/* object */o){
+ // summary
+ // check to see if the stack contains object o
+ for (var i=0; i<q.length; i++){
+ if (q[i] == o){
+ return true; // bool
+ }
+ }
+ return false; // bool
+ };
+ this.copyTo=function(/* array */ arr, /* int */ i){
+ // summary
+ // copy the stack into array arr at index i
+ arr.splice(i,0,q);
+ };
+ this.forEach=function(/* function */ fn, /* object? */ scope){
+ // summary
+ // functional iterator, following the mozilla spec.
+ var s=scope||dj_global;
+ if(Array.forEach){
+ Array.forEach(q, fn, s);
+ }else{
+ for(var i=0; i<q.length; i++){
+ fn.call(s, q[i], i, q);
+ }
+ }
+ };
+ this.getIterator=function(){
+ // summary
+ // get an iterator for this collection
+ return new dojo.collections.Iterator(q); // dojo.collections.Iterator
+ };
+ this.peek=function(){
+ // summary
+ // Return the next item without altering the stack itself.
+ return q[(q.length-1)]; // object
+ };
+ this.pop=function(){
+ // summary
+ // pop and return the next item on the stack
+ var r=q.pop();
+ this.count=q.length;
+ return r; // object
+ };
+ this.push=function(/* object */ o){
+ // summary
+ // Push object o onto the stack
+ this.count=q.push(o);
+ };
+ this.toArray=function(){
+ // summary
+ // create and return an array based on the internal collection
+ return [].concat(q); // array
+ };
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/Stack.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/__package__.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/__package__.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/__package__.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/__package__.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,22 @@
+/*
+ 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.collections.Collections",
+ "dojo.collections.SortedList",
+ "dojo.collections.Dictionary",
+ "dojo.collections.Queue",
+ "dojo.collections.ArrayList",
+ "dojo.collections.Stack",
+ "dojo.collections.Set"
+ ]
+});
+dojo.provide("dojo.collections.*");
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/collections/__package__.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/compat/0.2.2.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/compat/0.2.2.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/compat/0.2.2.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/compat/0.2.2.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,75 @@
+/*
+ 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
+*/
+
+/*
+Compatibility package to get 0.2.2 functionality in later Dojo releases.
+*/
+
+//**********************************
+//From bootstrap1.js
+dj_throw = dj_rethrow = function(m, e){
+ dojo.deprecated("dj_throw and dj_rethrow", "use dojo.raise instead", "0.4");
+ dojo.raise(m, e);
+}
+
+dj_debug = dojo.debug;
+dj_unimplemented = dojo.unimplemented;
+dj_deprecated = dojo.deprecated;
+
+dj_inherits = function(subclass, superclass){
+ dojo.deprecated("dj_inherits", "use dojo.inherits instead", "0.4");
+ dojo.inherits(subclass, superclass);
+}
+
+/**
+* Set the base script uri.
+*/
+// In JScript .NET, see interface System._AppDomain implemented by
+// System.AppDomain.CurrentDomain. Members include AppendPrivatePath,
+// RelativeSearchPath, BaseDirectory.
+dojo.hostenv.setBaseScriptUri = function(uri){ djConfig.baseScriptUri = uri }
+
+//**********************************
+//From the old bootstrap2.js
+dojo.hostenv.moduleLoaded = function(){
+ return dojo.hostenv.startPackage.apply(dojo.hostenv, arguments);
+}
+
+dojo.hostenv.require = dojo.hostenv.loadModule;
+dojo.requireAfter = dojo.require;
+dojo.conditionalRequire = dojo.requireIf;
+
+dojo.requireAll = function() {
+ for(var i = 0; i < arguments.length; i++) { dojo.require(arguments[i]); }
+}
+
+dojo.hostenv.conditionalLoadModule = function(){
+ dojo.kwCompoundRequire.apply(dojo, arguments);
+}
+
+dojo.hostenv.provide = dojo.hostenv.startPackage;
+
+//**********************************
+//From hostenv_browser.js
+dojo.hostenv.byId = dojo.byId;
+
+dojo.hostenv.byIdArray = dojo.byIdArray = function(){
+ var ids = [];
+ for(var i = 0; i < arguments.length; i++){
+ if((arguments[i] instanceof Array)||(typeof arguments[i] == "array")){
+ for(var j = 0; j < arguments[i].length; j++){
+ ids = ids.concat(dojo.hostenv.byIdArray(arguments[i][j]));
+ }
+ }else{
+ ids.push(dojo.hostenv.byId(arguments[i]));
+ }
+ }
+ return ids;
+}
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/compat/0.2.2.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/Rijndael.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/Rijndael.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/Rijndael.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/Rijndael.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,22 @@
+/*
+ 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.crypto.Rijndael");
+dojo.require("dojo.crypto");
+dojo.require("dojo.experimental");
+
+dojo.experimental("dojo.crypto.Rijndael");
+
+dojo.crypto.Rijndael = new function(){
+ this.encrypt=function(plaintext, key){
+ };
+ this.decrypt=function(ciphertext, key){
+ };
+}();
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/Rijndael.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/SHA1.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/SHA1.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/SHA1.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/SHA1.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,154 @@
+dojo.require("dojo.crypto");
+dojo.provide("dojo.crypto.SHA1");
+dojo.require("dojo.experimental");
+
+/*
+ * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
+ * in FIPS PUB 180-1
+ *
+ * Version 2.1a Copyright Paul Johnston 2000 - 2002.
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for details.
+ *
+ * Dojo port by Tom Trenka
+ */
+dojo.experimental("dojo.crypto.SHA1");
+
+dojo.crypto.SHA1 = new function(){
+ var chrsz=8;
+ var mask=(1<<chrsz)-1;
+ function toWord(s) {
+ var wa=[];
+ for(var i=0; i<s.length*chrsz; i+=chrsz)
+ wa[i>>5]|=(s.charCodeAt(i/chrsz)&mask)<<(i%32);
+ return wa;
+ }
+ function toString(wa){
+ var s=[];
+ for(var i=0; i<wa.length*32; i+=chrsz)
+ s.push(String.fromCharCode((wa[i>>5]>>>(i%32))&mask));
+ return s.join("");
+ }
+ function toHex(wa) {
+ var h="0123456789abcdef";
+ var s=[];
+ for(var i=0; i<wa.length*4; i++){
+ s.push(h.charAt((wa[i>>2]>>((i%4)*8+4))&0xF)+h.charAt((wa[i>>2]>>((i%4)*8))&0xF));
+ }
+ return s.join("");
+ }
+ function toBase64(wa){
+ var p="=";
+ var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ var s=[];
+ for(var i=0; i<wa.length*4; i+=3){
+ var t=(((wa[i>>2]>>8*(i%4))&0xFF)<<16)|(((wa[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((wa[i+2>>2]>>8*((i+2)%4))&0xFF);
+ for(var j=0; j<4; j++){
+ if(i*8+j*6>wa.length*32) s.push(p);
+ else s.push(tab.charAt((t>>6*(3-j))&0x3F));
+ }
+ }
+ return s.join("");
+ }
+
+ // math
+ function add(x,y){
+ var l=(x&0xffff)+(y&0xffff);
+ var m=(x>>16)+(y>>16)+(l>>16);
+ return (m<<16)|(l&0xffff);
+ }
+ function r(x,n){ return (x<<n)|(x>>>(32-n)); }
+
+ // SHA rounds
+ function f(u,v,w){ return ((u&v)|(~u&w)); }
+ function g(u,v,w){ return ((u&v)|(u&w)|(v&w)); }
+ function h(u,v,w){ return (u^v^w); }
+
+ function fn(i,u,v,w){
+ if(i<20) return f(u,v,w);
+ if(i<40) return h(u,v,w);
+ if(i<60) return g(u,v,w);
+ return h(u,v,w);
+ }
+ function cnst(i){
+ if(i<20) return 1518500249;
+ if(i<40) return 1859775393;
+ if(i<60) return -1894007588;
+ return -899497514;
+ }
+
+ function core(x,len){
+ x[len>>5]|=0x80<<(24-len%32);
+ x[((len+64>>9)<<4)+15]=len;
+
+ var w=[];
+ var a= 1732584193; // 0x67452301
+ var b=-271733879; // 0xefcdab89
+ var c=-1732584194; // 0x98badcfe
+ var d= 271733878; // 0x10325476
+ var e=-1009589776; // 0xc3d2e1f0
+
+ for(var i=0; i<x.length; i+=16){
+ var olda=a;
+ var oldb=b;
+ var oldc=c;
+ var oldd=d;
+ var olde=e;
+
+ for(var j=0; j<80; j++){
+ if(j<16) w[j]=x[i+j];
+ else w[j]=r(w[j-3]^w[j-8]^w[j-14]^w[j-16],1);
+ var t=add(add(r(a,5),fn(j,b,c,d)),add(add(e,w[j]),cnst(j)));
+ e=d; d=c; c=r(b,30); b=a; a=t;
+ }
+
+ a=add(a,olda);
+ b=add(b,oldb);
+ c=add(c,oldc);
+ d=add(d,oldd);
+ e=add(e,olde);
+ }
+ return [a,b,c,d,e];
+ }
+ function hmac(data,key){
+ var wa=toWord(key);
+ if(wa.length>16) wa=core(wa,key.length*chrsz);
+ var l=[], r=[];
+ for(var i=0; i<16; i++){
+ l[i]=wa[i]^0x36363636;
+ r[i]=wa[i]^0x5c5c5c5c;
+ }
+ var h=core(l.concat(toWord(data)),512+data.length*chrsz);
+ return core(r.concat(h),640);
+ }
+
+ this.compute=function(data,outputType){
+ var out=outputType||dojo.crypto.outputTypes.Base64;
+ switch(out){
+ case dojo.crypto.outputTypes.Hex:{
+ return toHex(core(toWord(data),data.length*chrsz));
+ }
+ case dojo.crypto.outputTypes.String:{
+ return toString(core(toWord(data),data.length*chrsz));
+ }
+ default:{
+ return toBase64(core(toWord(data),data.length*chrsz));
+ }
+ }
+ };
+ this.getHMAC=function(data,key,outputType){
+ var out=outputType||dojo.crypto.outputTypes.Base64;
+ switch(out){
+ case dojo.crypto.outputTypes.Hex:{
+ return toHex(hmac(data,key));
+ }
+ case dojo.crypto.outputTypes.String:{
+ return toString(hmac(data,key));
+ }
+ default:{
+ return toBase64(hmac(data,key));
+ }
+ }
+ };
+}();
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/crypto/SHA1.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Attribute.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Attribute.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Attribute.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Attribute.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,62 @@
+/*
+ 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.data.Attribute");
+dojo.require("dojo.data.Item");
+dojo.require("dojo.lang.assert");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+dojo.data.Attribute = function(/* dojo.data.provider.Base */ dataProvider, /* string */ attributeId) {
+ /**
+ * summary:
+ * An Attribute object represents something like a column in
+ * a relational database.
+ */
+ dojo.lang.assertType(dataProvider, [dojo.data.provider.Base, "optional"]);
+ dojo.lang.assertType(attributeId, String);
+ dojo.data.Item.call(this, dataProvider);
+ this._attributeId = attributeId;
+};
+dojo.inherits(dojo.data.Attribute, dojo.data.Item);
+
+// -------------------------------------------------------------------
+// Public instance methods
+// -------------------------------------------------------------------
+dojo.data.Attribute.prototype.toString = function() {
+ return this._attributeId; // string
+};
+
+dojo.data.Attribute.prototype.getAttributeId = function() {
+ /**
+ * summary:
+ * Returns the string token that uniquely identifies this
+ * attribute within the context of a data provider.
+ * For a data provider that accesses relational databases,
+ * typical attributeIds might be tokens like "name", "age",
+ * "ssn", or "dept_key".
+ */
+ return this._attributeId; // string
+};
+
+dojo.data.Attribute.prototype.getType = function() {
+ /**
+ * summary: Returns the data type of the values of this attribute.
+ */
+ return this.get('type'); // dojo.data.Type or null
+};
+
+dojo.data.Attribute.prototype.setType = function(/* dojo.data.Type or null */ type) {
+ /**
+ * summary: Sets the data type for this attribute.
+ */
+ this.set('type', type);
+};
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Attribute.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Item.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Item.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Item.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Item.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,332 @@
+/*
+ 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.data.Item");
+dojo.require("dojo.data.Observable");
+dojo.require("dojo.data.Value");
+dojo.require("dojo.lang.common");
+dojo.require("dojo.lang.assert");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+dojo.data.Item = function(/* dojo.data.provider.Base */ dataProvider) {
+ /**
+ * summary:
+ * An Item has attributes and attribute values, sort of like
+ * a record in a database, or a 'struct' in C. Instances of
+ * the Item class know how to store and retrieve their
+ * attribute values.
+ */
+ dojo.lang.assertType(dataProvider, [dojo.data.provider.Base, "optional"]);
+ dojo.data.Observable.call(this);
+ this._dataProvider = dataProvider;
+ this._dictionaryOfAttributeValues = {};
+};
+dojo.inherits(dojo.data.Item, dojo.data.Observable);
+
+// -------------------------------------------------------------------
+// Public class methods
+// -------------------------------------------------------------------
+dojo.data.Item.compare = function(/* dojo.data.Item */ itemOne, /* dojo.data.Item */ itemTwo) {
+ /**
+ * summary:
+ * Given two Items to compare, this method returns 0, 1, or -1.
+ * This method is designed to be used by sorting routines, like
+ * the JavaScript built-in Array sort() method.
+ *
+ * Example:
+ * <pre>
+ * var a = dataProvider.newItem("kermit");
+ * var b = dataProvider.newItem("elmo");
+ * var c = dataProvider.newItem("grover");
+ * var array = new Array(a, b, c);
+ * array.sort(dojo.data.Item.compare);
+ * </pre>
+ */
+ dojo.lang.assertType(itemOne, dojo.data.Item);
+ if (!dojo.lang.isOfType(itemTwo, dojo.data.Item)) {
+ return -1;
+ }
+ var nameOne = itemOne.getName();
+ var nameTwo = itemTwo.getName();
+ if (nameOne == nameTwo) {
+ var attributeArrayOne = itemOne.getAttributes();
+ var attributeArrayTwo = itemTwo.getAttributes();
+ if (attributeArrayOne.length != attributeArrayTwo.length) {
+ if (attributeArrayOne.length > attributeArrayTwo.length) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+ for (var i in attributeArrayOne) {
+ var attribute = attributeArrayOne[i];
+ var arrayOfValuesOne = itemOne.getValues(attribute);
+ var arrayOfValuesTwo = itemTwo.getValues(attribute);
+ dojo.lang.assert(arrayOfValuesOne && (arrayOfValuesOne.length > 0));
+ if (!arrayOfValuesTwo) {
+ return 1;
+ }
+ if (arrayOfValuesOne.length != arrayOfValuesTwo.length) {
+ if (arrayOfValuesOne.length > arrayOfValuesTwo.length) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+ for (var j in arrayOfValuesOne) {
+ var value = arrayOfValuesOne[j];
+ if (!itemTwo.hasAttributeValue(value)) {
+ return 1;
+ }
+ }
+ return 0;
+ }
+ } else {
+ if (nameOne > nameTwo) {
+ return 1;
+ } else {
+ return -1; // 0, 1, or -1
+ }
+ }
+};
+
+// -------------------------------------------------------------------
+// Public instance methods
+// -------------------------------------------------------------------
+dojo.data.Item.prototype.toString = function() {
+ /**
+ * Returns a simple string representation of the item.
+ */
+ var arrayOfStrings = [];
+ var attributes = this.getAttributes();
+ for (var i in attributes) {
+ var attribute = attributes[i];
+ var arrayOfValues = this.getValues(attribute);
+ var valueString;
+ if (arrayOfValues.length == 1) {
+ valueString = arrayOfValues[0];
+ } else {
+ valueString = '[';
+ valueString += arrayOfValues.join(', ');
+ valueString += ']';
+ }
+ arrayOfStrings.push(' ' + attribute + ': ' + valueString);
+ }
+ var returnString = '{ ';
+ returnString += arrayOfStrings.join(',\n');
+ returnString += ' }';
+ return returnString; // string
+};
+
+dojo.data.Item.prototype.compare = function(/* dojo.data.Item */ otherItem) {
+ /**
+ * summary: Compares this Item to another Item, and returns 0, 1, or -1.
+ */
+ return dojo.data.Item.compare(this, otherItem); // 0, 1, or -1
+};
+
+dojo.data.Item.prototype.isEqual = function(/* dojo.data.Item */ otherItem) {
+ /**
+ * summary: Returns true if this Item is equal to the otherItem, or false otherwise.
+ */
+ return (this.compare(otherItem) == 0); // boolean
+};
+
+dojo.data.Item.prototype.getName = function() {
+ return this.get('name');
+};
+
+dojo.data.Item.prototype.get = function(/* string or dojo.data.Attribute */ attributeId) {
+ /**
+ * summary: Returns a single literal value, like "foo" or 33.
+ */
+ // dojo.lang.assertType(attributeId, [String, dojo.data.Attribute]);
+ var literalOrValueOrArray = this._dictionaryOfAttributeValues[attributeId];
+ if (dojo.lang.isUndefined(literalOrValueOrArray)) {
+ return null; // null
+ }
+ if (literalOrValueOrArray instanceof dojo.data.Value) {
+ return literalOrValueOrArray.getValue(); // literal
+ }
+ if (dojo.lang.isArray(literalOrValueOrArray)) {
+ var dojoDataValue = literalOrValueOrArray[0];
+ return dojoDataValue.getValue(); // literal
+ }
+ return literalOrValueOrArray; // literal
+};
+
+dojo.data.Item.prototype.getValue = function(/* string or dojo.data.Attribute */ attributeId) {
+ /**
+ * summary: Returns a single instance of dojo.data.Value.
+ */
+ // dojo.lang.assertType(attributeId, [String, dojo.data.Attribute]);
+ var literalOrValueOrArray = this._dictionaryOfAttributeValues[attributeId];
+ if (dojo.lang.isUndefined(literalOrValueOrArray)) {
+ return null; // null
+ }
+ if (literalOrValueOrArray instanceof dojo.data.Value) {
+ return literalOrValueOrArray; // dojo.data.Value
+ }
+ if (dojo.lang.isArray(literalOrValueOrArray)) {
+ var dojoDataValue = literalOrValueOrArray[0];
+ return dojoDataValue; // dojo.data.Value
+ }
+ var literal = literalOrValueOrArray;
+ dojoDataValue = new dojo.data.Value(literal);
+ this._dictionaryOfAttributeValues[attributeId] = dojoDataValue;
+ return dojoDataValue; // dojo.data.Value
+};
+
+dojo.data.Item.prototype.getValues = function(/* string or dojo.data.Attribute */ attributeId) {
+ /**
+ * summary: Returns an array of dojo.data.Value objects.
+ */
+ // dojo.lang.assertType(attributeId, [String, dojo.data.Attribute]);
+ var literalOrValueOrArray = this._dictionaryOfAttributeValues[attributeId];
+ if (dojo.lang.isUndefined(literalOrValueOrArray)) {
+ return null; // null
+ }
+ if (literalOrValueOrArray instanceof dojo.data.Value) {
+ var array = [literalOrValueOrArray];
+ this._dictionaryOfAttributeValues[attributeId] = array;
+ return array; // Array
+ }
+ if (dojo.lang.isArray(literalOrValueOrArray)) {
+ return literalOrValueOrArray; // Array
+ }
+ var literal = literalOrValueOrArray;
+ var dojoDataValue = new dojo.data.Value(literal);
+ array = [dojoDataValue];
+ this._dictionaryOfAttributeValues[attributeId] = array;
+ return array; // Array
+};
+
+dojo.data.Item.prototype.load = function(/* string or dojo.data.Attribute */ attributeId, /* anything */ value) {
+ /**
+ * summary:
+ * Used for loading an attribute value into an item when
+ * the item is first being loaded into memory from some
+ * data store (such as a file).
+ */
+ // dojo.lang.assertType(attributeId, [String, dojo.data.Attribute]);
+ this._dataProvider.registerAttribute(attributeId);
+ var literalOrValueOrArray = this._dictionaryOfAttributeValues[attributeId];
+ if (dojo.lang.isUndefined(literalOrValueOrArray)) {
+ this._dictionaryOfAttributeValues[attributeId] = value;
+ return;
+ }
+ if (!(value instanceof dojo.data.Value)) {
+ value = new dojo.data.Value(value);
+ }
+ if (literalOrValueOrArray instanceof dojo.data.Value) {
+ var array = [literalOrValueOrArray, value];
+ this._dictionaryOfAttributeValues[attributeId] = array;
+ return;
+ }
+ if (dojo.lang.isArray(literalOrValueOrArray)) {
+ literalOrValueOrArray.push(value);
+ return;
+ }
+ var literal = literalOrValueOrArray;
+ var dojoDataValue = new dojo.data.Value(literal);
+ array = [dojoDataValue, value];
+ this._dictionaryOfAttributeValues[attributeId] = array;
+};
+
+dojo.data.Item.prototype.set = function(/* string or dojo.data.Attribute */ attributeId, /* anything */ value) {
+ /**
+ * summary:
+ * Used for setting an attribute value as a result of a
+ * user action.
+ */
+ // dojo.lang.assertType(attributeId, [String, dojo.data.Attribute]);
+ this._dataProvider.registerAttribute(attributeId);
+ this._dictionaryOfAttributeValues[attributeId] = value;
+ this._dataProvider.noteChange(this, attributeId, value);
+};
+
+dojo.data.Item.prototype.setValue = function(/* string or dojo.data.Attribute */ attributeId, /* dojo.data.Value */ value) {
+ this.set(attributeId, value);
+};
+
+dojo.data.Item.prototype.addValue = function(/* string or dojo.data.Attribute */ attributeId, /* anything */ value) {
+ /**
+ * summary:
+ * Used for adding an attribute value as a result of a
+ * user action.
+ */
+ this.load(attributeId, value);
+ this._dataProvider.noteChange(this, attributeId, value);
+};
+
+dojo.data.Item.prototype.setValues = function(/* string or dojo.data.Attribute */ attributeId, /* Array */ arrayOfValues) {
+ /**
+ * summary:
+ * Used for setting an array of attribute values as a result of a
+ * user action.
+ */
+ // dojo.lang.assertType(attributeId, [String, dojo.data.Attribute]);
+ dojo.lang.assertType(arrayOfValues, Array);
+ this._dataProvider.registerAttribute(attributeId);
+ var finalArray = [];
+ this._dictionaryOfAttributeValues[attributeId] = finalArray;
+ for (var i in arrayOfValues) {
+ var value = arrayOfValues[i];
+ if (!(value instanceof dojo.data.Value)) {
+ value = new dojo.data.Value(value);
+ }
+ finalArray.push(value);
+ this._dataProvider.noteChange(this, attributeId, value);
+ }
+};
+
+dojo.data.Item.prototype.getAttributes = function() {
+ /**
+ * summary:
+ * Returns an array containing all of the attributes for which
+ * this item has attribute values.
+ */
+ var arrayOfAttributes = [];
+ for (var key in this._dictionaryOfAttributeValues) {
+ arrayOfAttributes.push(this._dataProvider.getAttribute(key));
+ }
+ return arrayOfAttributes; // Array
+};
+
+dojo.data.Item.prototype.hasAttribute = function(/* string or dojo.data.Attribute */ attributeId) {
+ /**
+ * summary: Returns true if the given attribute of the item has been assigned any value.
+ */
+ // dojo.lang.assertType(attributeId, [String, dojo.data.Attribute]);
+ for (var key in this._dictionaryOfAttributeValues) {
+ if (key == attributeId) {
+ return true; // boolean
+ }
+ }
+ return false; // boolean
+};
+
+dojo.data.Item.prototype.hasAttributeValue = function(/* string or dojo.data.Attribute */ attributeId, /* anything */ value) {
+ /**
+ * summary: Returns true if the given attribute of the item has been assigned the given value.
+ */
+ var arrayOfValues = this.getValues(attributeId);
+ for (var i in arrayOfValues) {
+ var candidateValue = arrayOfValues[i];
+ if (candidateValue.isEqual(value)) {
+ return true; // boolean
+ }
+ }
+ return false; // boolean
+};
+
+
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Item.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Kind.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Kind.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Kind.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Kind.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,28 @@
+/*
+ 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.data.Kind");
+dojo.require("dojo.data.Item");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+dojo.data.Kind = function(/* dojo.data.provider.Base */ dataProvider) {
+ /**
+ * summary:
+ * A Kind represents a kind of item. In the dojo data model
+ * the item Snoopy might belong to the 'kind' Dog, where in
+ * a Java program the object Snoopy would belong to the 'class'
+ * Dog, and in MySQL the record for Snoopy would be in the
+ * table Dog.
+ */
+ dojo.data.Item.call(this, dataProvider);
+};
+dojo.inherits(dojo.data.Kind, dojo.data.Item);
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/Kind.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Csv.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Csv.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Csv.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Csv.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,112 @@
+/*
+ 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.data.format.Csv");
+dojo.require("dojo.lang.assert");
+
+
+dojo.data.format.Csv = new function() {
+
+ // -------------------------------------------------------------------
+ // Public functions
+ // -------------------------------------------------------------------
+ this.getArrayStructureFromCsvFileContents = function(/* string */ csvFileContents) {
+ /**
+ * Given a string containing CSV records, this method parses
+ * the string and returns a data structure containing the parsed
+ * content. The data structure we return is an array of length
+ * R, where R is the number of rows (lines) in the CSV data. The
+ * return array contains one sub-array for each CSV line, and each
+ * sub-array contains C string values, where C is the number of
+ * columns in the CSV data.
+ *
+ * For example, given this CSV string as input:
+ * <pre>
+ * "Title, Year, Producer \n Alien, 1979, Ridley Scott \n Blade Runner, 1982, Ridley Scott"
+ * </pre>
+ * We will return this data structure:
+ * <pre>
+ * [["Title", "Year", "Producer"]
+ * ["Alien", "1979", "Ridley Scott"],
+ * ["Blade Runner", "1982", "Ridley Scott"]]
+ * </pre>
+ */
+ dojo.lang.assertType(csvFileContents, String);
+
+ var lineEndingCharacters = new RegExp("\r\n|\n|\r");
+ var leadingWhiteSpaceCharacters = new RegExp("^\\s+",'g');
+ var trailingWhiteSpaceCharacters = new RegExp("\\s+$",'g');
+ var doubleQuotes = new RegExp('""','g');
+ var arrayOfOutputRecords = [];
+
+ var arrayOfInputLines = csvFileContents.split(lineEndingCharacters);
+ for (var i in arrayOfInputLines) {
+ var singleLine = arrayOfInputLines[i];
+ if (singleLine.length > 0) {
+ var listOfFields = singleLine.split(',');
+ var j = 0;
+ while (j < listOfFields.length) {
+ var space_field_space = listOfFields[j];
+ var field_space = space_field_space.replace(leadingWhiteSpaceCharacters, ''); // trim leading whitespace
+ var field = field_space.replace(trailingWhiteSpaceCharacters, ''); // trim trailing whitespace
+ var firstChar = field.charAt(0);
+ var lastChar = field.charAt(field.length - 1);
+ var secondToLastChar = field.charAt(field.length - 2);
+ var thirdToLastChar = field.charAt(field.length - 3);
+ if ((firstChar == '"') &&
+ ((lastChar != '"') ||
+ ((lastChar == '"') && (secondToLastChar == '"') && (thirdToLastChar != '"')) )) {
+ if (j+1 === listOfFields.length) {
+ // alert("The last field in record " + i + " is corrupted:\n" + field);
+ return null;
+ }
+ var nextField = listOfFields[j+1];
+ listOfFields[j] = field_space + ',' + nextField;
+ listOfFields.splice(j+1, 1); // delete element [j+1] from the list
+ } else {
+ if ((firstChar == '"') && (lastChar == '"')) {
+ field = field.slice(1, (field.length - 1)); // trim the " characters off the ends
+ field = field.replace(doubleQuotes, '"'); // replace "" with "
+ }
+ listOfFields[j] = field;
+ j += 1;
+ }
+ }
+ arrayOfOutputRecords.push(listOfFields);
+ }
+ }
+ return arrayOfOutputRecords; // Array
+ };
+
+ this.loadDataProviderFromFileContents = function(/* dojo.data.provider.Base */ dataProvider, /* string */ csvFileContents) {
+ dojo.lang.assertType(dataProvider, dojo.data.provider.Base);
+ dojo.lang.assertType(csvFileContents, String);
+ var arrayOfArrays = this.getArrayStructureFromCsvFileContents(csvFileContents);
+ if (arrayOfArrays) {
+ var arrayOfKeys = arrayOfArrays[0];
+ for (var i = 1; i < arrayOfArrays.length; ++i) {
+ var row = arrayOfArrays[i];
+ var item = dataProvider.getNewItemToLoad();
+ for (var j in row) {
+ var value = row[j];
+ var key = arrayOfKeys[j];
+ item.load(key, value);
+ }
+ }
+ }
+ };
+
+ this.getCsvStringFromResultSet = function(/* dojo.data.ResultSet */ resultSet) {
+ dojo.unimplemented('dojo.data.format.Csv.getCsvStringFromResultSet');
+ var csvString = null;
+ return csvString; // String
+ };
+
+}();
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Csv.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Json.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Json.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Json.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Json.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,103 @@
+/*
+ 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.data.format.Json");
+dojo.require("dojo.lang.assert");
+
+dojo.data.format.Json = new function() {
+
+ // -------------------------------------------------------------------
+ // Public functions
+ // -------------------------------------------------------------------
+ this.loadDataProviderFromFileContents = function(/* dojo.data.provider.Base */ dataProvider, /* string */ jsonFileContents) {
+ dojo.lang.assertType(dataProvider, dojo.data.provider.Base);
+ dojo.lang.assertType(jsonFileContents, String);
+ var arrayOfJsonData = eval("(" + jsonFileContents + ")");
+ this.loadDataProviderFromArrayOfJsonData(dataProvider, arrayOfJsonData);
+ };
+
+ this.loadDataProviderFromArrayOfJsonData = function(/* dojo.data.provider.Base */ dataProvider, /* Array */ arrayOfJsonData) {
+ dojo.lang.assertType(arrayOfJsonData, [Array, "optional"]);
+ if (arrayOfJsonData && (arrayOfJsonData.length > 0)) {
+ var firstRow = arrayOfJsonData[0];
+ dojo.lang.assertType(firstRow, [Array, "pureobject"]);
+ if (dojo.lang.isArray(firstRow)) {
+ _loadDataProviderFromArrayOfArrays(dataProvider, arrayOfJsonData);
+ } else {
+ dojo.lang.assertType(firstRow, "pureobject");
+ _loadDataProviderFromArrayOfObjects(dataProvider, arrayOfJsonData);
+ }
+ }
+ };
+
+ this.getJsonStringFromResultSet = function(/* dojo.data.ResultSet */ resultSet) {
+ dojo.unimplemented('dojo.data.format.Json.getJsonStringFromResultSet');
+ var jsonString = null;
+ return jsonString; // String
+ };
+
+ // -------------------------------------------------------------------
+ // Private functions
+ // -------------------------------------------------------------------
+ function _loadDataProviderFromArrayOfArrays(/* dojo.data.provider.Base */ dataProvider, /* Array */ arrayOfJsonData) {
+ /**
+ * Example:
+ * var arrayOfJsonStates = [
+ * [ "abbr", "population", "name" ]
+ * [ "WA", 5894121, "Washington" ],
+ * [ "WV", 1808344, "West Virginia" ],
+ * [ "WI", 5453896, "Wisconsin" ],
+ * [ "WY", 493782, "Wyoming" ] ];
+ * this._loadFromArrayOfArrays(arrayOfJsonStates);
+ */
+ var arrayOfKeys = arrayOfJsonData[0];
+ for (var i = 1; i < arrayOfJsonData.length; ++i) {
+ var row = arrayOfJsonData[i];
+ var item = dataProvider.getNewItemToLoad();
+ for (var j in row) {
+ var value = row[j];
+ var key = arrayOfKeys[j];
+ item.load(key, value);
+ }
+ }
+ }
+
+ function _loadDataProviderFromArrayOfObjects(/* dojo.data.provider.Base */ dataProvider, /* Array */ arrayOfJsonData) {
+ /**
+ * Example:
+ * var arrayOfJsonStates = [
+ * { abbr: "WA", name: "Washington" },
+ * { abbr: "WV", name: "West Virginia" },
+ * { abbr: "WI", name: "Wisconsin", song: "On, Wisconsin!" },
+ * { abbr: "WY", name: "Wyoming", cities: ["Lander", "Cheyenne", "Laramie"] } ];
+ * this._loadFromArrayOfArrays(arrayOfJsonStates);
+ */
+ // dojo.debug("_loadDataProviderFromArrayOfObjects");
+ for (var i in arrayOfJsonData) {
+ var row = arrayOfJsonData[i];
+ var item = dataProvider.getNewItemToLoad();
+ for (var key in row) {
+ var value = row[key];
+ if (dojo.lang.isArray(value)) {
+ var arrayOfValues = value;
+ for (var j in arrayOfValues) {
+ value = arrayOfValues[j];
+ item.load(key, value);
+ // dojo.debug("loaded: " + key + " = " + value);
+ }
+ } else {
+ item.load(key, value);
+ }
+ }
+ }
+ }
+
+}();
+
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/format/Json.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/JotSpot.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/JotSpot.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/JotSpot.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/JotSpot.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,27 @@
+/*
+ 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.data.provider.JotSpot");
+dojo.require("dojo.data.provider.Base");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+dojo.data.provider.JotSpot = function() {
+ /**
+ * summary:
+ * A JotSpot Data Provider knows how to read data from a JotSpot data
+ * store and make the contents accessable as dojo.data.Items.
+ */
+ dojo.unimplemented('dojo.data.provider.JotSpot');
+};
+
+dojo.inherits(dojo.data.provider.JotSpot, dojo.data.provider.Base);
+
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/JotSpot.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/MySql.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/MySql.js?rev=413300&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/MySql.js (added)
+++ tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/MySql.js Sat Jun 10 06:59:28 2006
@@ -0,0 +1,27 @@
+/*
+ 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.data.provider.MySql");
+dojo.require("dojo.data.provider.Base");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+dojo.data.provider.MySql = function() {
+ /**
+ * summary:
+ * A MySql Data Provider knows how to connect to a MySQL database
+ * on a server and and make the content records available as
+ * dojo.data.Items.
+ */
+ dojo.unimplemented('dojo.data.provider.MySql');
+};
+
+dojo.inherits(dojo.data.provider.MySql, dojo.data.provider.Base);
Propchange: tapestry/tapestry4/trunk/framework/src/js/dojo/src/data/provider/MySql.js
------------------------------------------------------------------------------
svn:eol-style = native