You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by mr...@apache.org on 2006/04/14 01:47:17 UTC
svn commit: r393978 [8/25] - in
/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo:
./ demos/ demos/widget/ demos/widget/EditorTree/
demos/widget/EditorTree/static/ demos/widget/Mail/ demos/widget/images/
src/ src/alg/ ...
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/alg/Alg.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/alg/Alg.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/alg/Alg.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/alg/Alg.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,49 @@
+/*
+ Copyright (c) 2004-2005, 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.alg.Alg");
+dojo.require("dojo.lang");
+dj_deprecated("dojo.alg.Alg is deprecated, use dojo.lang instead");
+
+dojo.alg.find = function(arr, val){ return dojo.lang.find(arr, val); }
+
+dojo.alg.inArray = function(arr, val){
+ return dojo.lang.inArray(arr, val);
+}
+dojo.alg.inArr = dojo.alg.inArray; // for backwards compatibility
+
+dojo.alg.getNameInObj = function(ns, item){
+ return dojo.lang.getNameInObj(ns, item);
+}
+
+// is this the right place for this?
+dojo.alg.has = function(obj, name){
+ return dojo.lang.has(obj, name);
+}
+
+dojo.alg.forEach = function(arr, unary_func, fix_length){
+ return dojo.lang.forEach(arr, unary_func, fix_length);
+}
+
+dojo.alg.for_each = dojo.alg.forEach; // burst compat
+
+dojo.alg.map = function(arr, obj, unary_func){
+ return dojo.lang.map(arr, obj, unary_func);
+}
+
+dojo.alg.tryThese = function(){
+ return dojo.lang.tryThese.apply(dojo.lang, arguments);
+}
+
+dojo.alg.delayThese = function(farr, cb, delay, onend){
+ return dojo.lang.delayThese.apply(dojo.lang, arguments);
+}
+
+dojo.alg.for_each_call = dojo.alg.map; // burst compat
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/alg/__package__.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/alg/__package__.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/alg/__package__.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/alg/__package__.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,12 @@
+/*
+ Copyright (c) 2004-2005, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.alg.Alg", false, true);
+dojo.hostenv.moduleLoaded("dojo.alg.*");
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/Animation.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/Animation.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/Animation.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/Animation.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,361 @@
+/*
+ Copyright (c) 2004-2005, 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");
+dojo.provide("dojo.animation.Animation");
+
+dojo.require("dojo.lang");
+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(curve, duration, accel, repeatCount, rate) {
+ // public properties
+ if(dojo.lang.isArray(curve)) {
+ 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) {
+ if(dojo.lang.isFunction(accel.getValue)) {
+ 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); }
+
+ //dojo.lang.hitch(this, cycle)();
+ 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, Math.round(fps));
+ 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);
+ 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();
+ }
+ }
+ }
+ }
+ }
+});
+
+dojo.animation.AnimationEvent = function(anim, type, coords, sTime, cTime, eTime, dur, pct, fps) {
+ this.type = type; // "animate", "begin", "end", "play", "pause", "stop"
+ this.animation = anim;
+
+ this.coords = coords;
+ this.x = coords[0];
+ this.y = coords[1];
+ this.z = coords[2];
+
+ this.startTime = sTime;
+ this.currentTime = cTime;
+ this.endTime = eTime;
+
+ this.duration = dur;
+ this.percent = pct;
+ this.fps = fps;
+};
+dojo.lang.extend(dojo.animation.AnimationEvent, {
+ coordsAsInts: function() {
+ var cints = new Array(this.coords.length);
+ for(var i = 0; i < this.coords.length; i++) {
+ cints[i] = Math.round(this.coords[i]);
+ }
+ return cints;
+ }
+});
+
+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;
+ }
+ }
+ }
+});
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/Timer.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/Timer.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/Timer.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/Timer.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,39 @@
+/*
+ Copyright (c) 2004-2005, 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");
+
+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);
+ };
+};
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/__package__.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/__package__.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/__package__.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/animation/__package__.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,14 @@
+/*
+ Copyright (c) 2004-2005, 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.conditionalLoadModule({
+ common: ["dojo.animation.Animation", false, false]
+});
+dojo.hostenv.moduleLoaded("dojo.animation.*");
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/bootstrap1.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/bootstrap1.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/bootstrap1.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/bootstrap1.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,663 @@
+/*
+ Copyright (c) 2004-2005, 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
+*/
+
+/**
+* @file bootstrap1.js
+*
+* bootstrap file that runs before hostenv_*.js file.
+*
+* @author Copyright 2004 Mark D. Anderson (mda@discerning.com)
+* @author Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php
+*
+* $Id: bootstrap1.js 2836 2006-01-16 08:36:18Z alex $
+*/
+
+/**
+ * The global djConfig can be set prior to loading the library, to override
+ * certain settings. It does not exist under dojo.* so that it can be set
+ * before the dojo variable exists. Setting any of these variables *after* the
+ * library has loaded does nothing at all. The variables that can be set are
+ * as follows:
+ */
+
+/**
+ * dj_global is an alias for the top-level global object in the host
+ * environment (the "window" object in a browser).
+ */
+var dj_global = this; //typeof window == 'undefined' ? this : window;
+
+function dj_undef(name, obj){
+ if(!obj){ obj = dj_global; }
+ return (typeof obj[name] == "undefined");
+}
+
+if(dj_undef("djConfig")){
+ var djConfig = {};
+}
+
+/**
+ * dojo is the root variable of (almost all) our public symbols.
+ */
+var dojo;
+if(dj_undef("dojo")){ dojo = {}; }
+
+dojo.version = {
+ major: 0, minor: 2, patch: 2, flag: "",
+ revision: Number("$Rev: 2836 $".match(/[0-9]+/)[0]),
+ toString: function() {
+ with (dojo.version) {
+ return major + "." + minor + "." + patch + flag + " (" + revision + ")";
+ }
+ }
+};
+
+/*
+ * evaluate a string like "A.B" without using eval.
+ */
+dojo.evalObjPath = function(objpath, create){
+ // fast path for no periods
+ if(typeof objpath != "string"){ return dj_global; }
+ if(objpath.indexOf('.') == -1){
+ if((dj_undef(objpath, dj_global))&&(create)){
+ dj_global[objpath] = {};
+ }
+ return dj_global[objpath];
+ }
+
+ var syms = objpath.split(/\./);
+ var obj = dj_global;
+ for(var i=0;i<syms.length;++i){
+ if(!create){
+ obj = obj[syms[i]];
+ if((typeof obj == 'undefined')||(!obj)){
+ return obj;
+ }
+ }else{
+ if(dj_undef(syms[i], obj)){
+ obj[syms[i]] = {};
+ }
+ obj = obj[syms[i]];
+ }
+ }
+ return obj;
+};
+
+
+// ****************************************************************
+// global public utils
+// ****************************************************************
+
+/*
+ * utility to print an Error.
+ * TODO: overriding Error.prototype.toString won't accomplish this?
+ * ... since natively generated Error objects do not always reflect such things?
+ */
+dojo.errorToString = function(excep){
+ return ((!dj_undef("message", excep)) ? excep.message : (dj_undef("description", excep) ? excep : excep.description ));
+};
+
+/**
+* Throws an Error object given the string err. For now, will also do a println
+* to the user first.
+*/
+dojo.raise = function(message, excep){
+ if(excep){
+ message = message + ": "+dojo.errorToString(excep);
+ }
+ var he = dojo.hostenv;
+ if((!dj_undef("hostenv", dojo))&&(!dj_undef("println", dojo.hostenv))){
+ dojo.hostenv.println("FATAL: " + message);
+ }
+ throw Error(message);
+};
+
+dj_throw = dj_rethrow = function(m, e){
+ dojo.deprecated("dj_throw and dj_rethrow deprecated, use dojo.raise instead");
+ dojo.raise(m, e);
+};
+
+/**
+ * Produce a line of debug output.
+ * Does nothing unless djConfig.isDebug is true.
+ * varargs, joined with ''.
+ * Caller should not supply a trailing "\n".
+ */
+dojo.debug = function(){
+ if (!djConfig.isDebug) { return; }
+ var args = arguments;
+ if(dj_undef("println", dojo.hostenv)){
+ dojo.raise("dojo.debug not available (yet?)");
+ }
+ var isJUM = dj_global["jum"] && !dj_global["jum"].isBrowser;
+ var s = [(isJUM ? "": "DEBUG: ")];
+ for(var i=0;i<args.length;++i){
+ if(!false && args[i] instanceof Error){
+ var msg = "[" + args[i].name + ": " + dojo.errorToString(args[i]) +
+ (args[i].fileName ? ", file: " + args[i].fileName : "") +
+ (args[i].lineNumber ? ", line: " + args[i].lineNumber : "") + "]";
+ } else {
+ try {
+ var msg = String(args[i]);
+ } catch(e) {
+ if(dojo.render.html.ie) {
+ var msg = "[ActiveXObject]";
+ } else {
+ var msg = "[unknown]";
+ }
+ }
+ }
+ s.push(msg);
+ }
+ if(isJUM){ // this seems to be the only way to get JUM to "play nice"
+ jum.debug(s.join(" "));
+ }else{
+ dojo.hostenv.println(s.join(" "));
+ }
+}
+
+/**
+ * this is really hacky for now - just
+ * display the properties of the object
+**/
+
+dojo.debugShallow = function(obj){
+ if (!djConfig.isDebug) { return; }
+ dojo.debug('------------------------------------------------------------');
+ dojo.debug('Object: '+obj);
+ for(i in obj){
+ dojo.debug(i + ': ' + obj[i]);
+ }
+ dojo.debug('------------------------------------------------------------');
+}
+
+var dj_debug = dojo.debug;
+
+/**
+ * We put eval() in this separate function to keep down the size of the trapped
+ * evaluation context.
+ *
+ * Note that:
+ * - 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.
+*/
+function dj_eval(s){ return dj_global.eval ? dj_global.eval(s) : eval(s); }
+
+
+/**
+ * Convenience for throwing an exception because some function is not
+ * implemented.
+ */
+dj_unimplemented = dojo.unimplemented = function(funcname, extra){
+ // FIXME: need to move this away from dj_*
+ var mess = "'" + funcname + "' not implemented";
+ if((!dj_undef(extra))&&(extra)){ mess += " " + extra; }
+ dojo.raise(mess);
+}
+
+/**
+ * Convenience for informing of deprecated behaviour.
+ */
+dj_deprecated = dojo.deprecated = function(behaviour, extra, removal){
+ var mess = "DEPRECATED: " + behaviour;
+ if(extra){ mess += " " + extra; }
+ if(removal){ mess += " -- will be removed in version: " + removal; }
+ dojo.debug(mess);
+}
+
+/**
+ * Does inheritance
+ */
+dojo.inherits = function(subclass, superclass){
+ if(typeof superclass != 'function'){
+ dojo.raise("superclass: "+superclass+" borken");
+ }
+ subclass.prototype = new superclass();
+ subclass.prototype.constructor = subclass;
+ subclass.superclass = superclass.prototype;
+ // DEPRICATED: super is a reserved word, use 'superclass'
+ subclass['super'] = superclass.prototype;
+}
+
+dj_inherits = function(subclass, superclass){
+ dojo.deprecated("dj_inherits deprecated, use dojo.inherits instead");
+ dojo.inherits(subclass, superclass);
+}
+
+// an object that authors use determine what host we are running under
+dojo.render = (function(){
+
+ function vscaffold(prefs, names){
+ var tmp = {
+ capable: false,
+ support: {
+ builtin: false,
+ plugin: false
+ },
+ prefixes: prefs
+ };
+ for(var x in names){
+ tmp[x] = 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(){
+
+ // 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];
+ }
+ }
+ }
+
+ var djc = djConfig;
+ function _def(obj, name, def){
+ return (dj_undef(name, obj) ? def : obj[name]);
+ }
+
+ return {
+ name_: '(unset)',
+ version_: '(unset)',
+ pkgFileName: "__package__",
+
+ // for recursion protection
+ loading_modules_: {},
+ loaded_modules_: {},
+ addedToLoadingCount: [],
+ removedFromLoadingCount: [],
+ inFlightCount: 0,
+ // FIXME: it should be possible to pull module prefixes in from djConfig
+ modulePrefixes_: {
+ dojo: {name: "dojo", value: "src"}
+ },
+
+
+ setModulePrefix: function(module, prefix){
+ this.modulePrefixes_[module] = {name: module, value: prefix};
+ },
+
+ getModulePrefix: function(module){
+ var mp = this.modulePrefixes_;
+ if((mp[module])&&(mp[module]["name"])){
+ return mp[module].value;
+ }
+ return module;
+ },
+
+ getTextStack: [],
+ loadUriStack: [],
+ loadedUris: [],
+ // lookup cache for modules.
+ // NOTE: this is partially redundant a private variable in the jsdown
+ // implementation, but we don't want to couple the two.
+ // modules_ : {},
+ post_load_: false,
+ modulesLoadedListeners: [],
+ /**
+ * Return the name of the hostenv.
+ */
+ getName: function(){ return this.name_; },
+
+ /**
+ * Return the version of the hostenv.
+ */
+ getVersion: function(){ return this.version_; },
+
+ /**
+ * Read the plain/text contents at the specified uri. If getText() is
+ * not implemented, then it is necessary to override loadUri() with an
+ * implementation that doesn't rely on it.
+ */
+ getText: function(uri){
+ dojo.unimplemented('getText', "uri=" + uri);
+ },
+
+ /**
+ * return the uri of the script that defined this function
+ * private method that must be implemented by the hostenv.
+ */
+ getLibraryScriptUri: function(){
+ // FIXME: need to implement!!!
+ dojo.unimplemented('getLibraryScriptUri','');
+ }
+ };
+})();
+
+/**
+ * Display a line of text to the user.
+ * The line argument should not contain a trailing "\n"; that is added by the
+ * implementation.
+ */
+//dojo.hostenv.println = function(line) {}
+
+// ****************************************************************
+// dojo.hostenv methods not defined in hostenv_*.js
+// ****************************************************************
+
+/**
+ * Return the base script uri that other scripts are found relative to.
+ * It is either the empty string, or a non-empty string ending in '/'.
+ */
+dojo.hostenv.getBaseScriptUri = function(){
+ if(djConfig.baseScriptUri.length){
+ return djConfig.baseScriptUri;
+ }
+ var uri = new String(djConfig.libraryScriptUri||djConfig.baseRelativePath);
+ if (!uri) { dojo.raise("Nothing returned by getLibraryScriptUri(): " + uri); }
+
+ var lastslash = uri.lastIndexOf('/');
+ djConfig.baseScriptUri = djConfig.baseRelativePath;
+ return djConfig.baseScriptUri;
+}
+
+/**
+* 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 }
+
+/**
+ * Loads and interprets the script located at relpath, which is relative to the
+ * script root directory. If the script is found but its interpretation causes
+ * a runtime exception, that exception is not caught by us, so the caller will
+ * see it. We return a true value if and only if the script is found.
+ *
+ * For now, we do not have an implementation of a true search path. We
+ * consider only the single base script uri, as returned by getBaseScriptUri().
+ *
+ * @param relpath A relative path to a script (no leading '/', and typically
+ * ending in '.js').
+ * @param module A module whose existance to check for after loading a path.
+ * Can be used to determine success or failure of the load.
+ */
+dojo.hostenv.loadPath = function(relpath, module /*optional*/, cb /*optional*/){
+ if((relpath.charAt(0) == '/')||(relpath.match(/^\w+:/))){
+ dojo.raise("relpath '" + relpath + "'; must be relative");
+ }
+ var uri = this.getBaseScriptUri() + relpath;
+ if(djConfig.cacheBust && dojo.render.html.capable) { uri += "?" + String(djConfig.cacheBust).replace(/\W+/g,""); }
+ try{
+ return ((!module) ? this.loadUri(uri, cb) : this.loadUriAndCheck(uri, module, cb));
+ }catch(e){
+ dojo.debug(e);
+ return false;
+ }
+}
+
+/**
+ * Reads the contents of the URI, and evaluates the contents.
+ * Returns true if it succeeded. Returns false if the URI reading failed.
+ * Throws if the evaluation throws.
+ * The result of the eval is not available to the caller.
+ */
+dojo.hostenv.loadUri = function(uri, cb){
+ if(this.loadedUris[uri]){
+ return;
+ }
+ var contents = this.getText(uri, null, true);
+ if(contents == null){ return 0; }
+ this.loadedUris[uri] = true;
+ var value = dj_eval(contents);
+ return 1;
+}
+
+// FIXME: probably need to add logging to this method
+dojo.hostenv.loadUriAndCheck = function(uri, module, cb){
+ var ok = true;
+ try{
+ ok = this.loadUri(uri, cb);
+ }catch(e){
+ dojo.debug("failed loading ", uri, " with error: ", e);
+ }
+ return ((ok)&&(this.findModule(module, false))) ? true : false;
+}
+
+dojo.loaded = function(){ }
+
+dojo.hostenv.loaded = function(){
+ this.post_load_ = true;
+ var mll = this.modulesLoadedListeners;
+ for(var x=0; x<mll.length; x++){
+ mll[x]();
+ }
+ dojo.loaded();
+}
+
+/*
+Call styles:
+ dojo.addOnLoad(functionPointer)
+ dojo.addOnLoad(object, "functionName")
+*/
+dojo.addOnLoad = function(obj, fcnName) {
+ if(arguments.length == 1) {
+ dojo.hostenv.modulesLoadedListeners.push(obj);
+ } else if(arguments.length > 1) {
+ dojo.hostenv.modulesLoadedListeners.push(function() {
+ obj[fcnName]();
+ });
+ }
+};
+
+dojo.hostenv.modulesLoaded = function(){
+ if(this.post_load_){ return; }
+ if((this.loadUriStack.length==0)&&(this.getTextStack.length==0)){
+ if(this.inFlightCount > 0){
+ dojo.debug("files still in flight!");
+ return;
+ }
+ if(typeof setTimeout == "object"){
+ setTimeout("dojo.hostenv.loaded();", 0);
+ }else{
+ dojo.hostenv.loaded();
+ }
+ }
+}
+
+dojo.hostenv.moduleLoaded = function(modulename){
+ var modref = dojo.evalObjPath((modulename.split(".").slice(0, -1)).join('.'));
+ this.loaded_modules_[(new String(modulename)).toLowerCase()] = modref;
+}
+
+/**
+* loadModule("A.B") first checks to see if symbol A.B is defined.
+* If it is, it is simply returned (nothing to do).
+*
+* If it is not defined, it will look for "A/B.js" in the script root directory,
+* followed by "A.js".
+*
+* It throws if it cannot find a file to load, or if the symbol A.B is not
+* defined after loading.
+*
+* It returns the object A.B.
+*
+* This does nothing about importing symbols into the current package.
+* It is presumed that the caller will take care of that. For example, to import
+* all symbols:
+*
+* with (dojo.hostenv.loadModule("A.B")) {
+* ...
+* }
+*
+* And to import just the leaf symbol:
+*
+* var B = dojo.hostenv.loadModule("A.B");
+* ...
+*
+* dj_load is an alias for dojo.hostenv.loadModule
+*/
+dojo.hostenv._global_omit_module_check = false;
+dojo.hostenv.loadModule = function(modulename, exact_only, omit_module_check){
+ if(!modulename){ return; }
+ omit_module_check = this._global_omit_module_check || omit_module_check;
+ var module = this.findModule(modulename, false);
+ if(module){
+ return module;
+ }
+
+ // protect against infinite recursion from mutual dependencies
+ if(dj_undef(modulename, this.loading_modules_)){
+ this.addedToLoadingCount.push(modulename);
+ }
+ this.loading_modules_[modulename] = 1;
+
+ // convert periods to slashes
+ var relpath = modulename.replace(/\./g, '/') + '.js';
+
+ var syms = modulename.split(".");
+ var nsyms = modulename.split(".");
+ for (var i = syms.length - 1; i > 0; i--) {
+ var parentModule = syms.slice(0, i).join(".");
+ var parentModulePath = this.getModulePrefix(parentModule);
+ if (parentModulePath != parentModule) {
+ syms.splice(0, i, parentModulePath);
+ break;
+ }
+ }
+ var last = syms[syms.length - 1];
+ // figure out if we're looking for a full package, if so, we want to do
+ // things slightly diffrently
+ if(last=="*"){
+ modulename = (nsyms.slice(0, -1)).join('.');
+
+ while(syms.length){
+ syms.pop();
+ syms.push(this.pkgFileName);
+ relpath = syms.join("/") + '.js';
+ if(relpath.charAt(0)=="/"){
+ relpath = relpath.slice(1);
+ }
+ ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null));
+ if(ok){ break; }
+ syms.pop();
+ }
+ }else{
+ relpath = syms.join("/") + '.js';
+ modulename = nsyms.join('.');
+ var ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null));
+ if((!ok)&&(!exact_only)){
+ syms.pop();
+ while(syms.length){
+ relpath = syms.join('/') + '.js';
+ ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null));
+ if(ok){ break; }
+ syms.pop();
+ relpath = syms.join('/') + '/'+this.pkgFileName+'.js';
+ if(relpath.charAt(0)=="/"){
+ relpath = relpath.slice(1);
+ }
+ ok = this.loadPath(relpath, ((!omit_module_check) ? modulename : null));
+ if(ok){ break; }
+ }
+ }
+
+ if((!ok)&&(!omit_module_check)){
+ dojo.raise("Could not load '" + modulename + "'; last tried '" + relpath + "'");
+ }
+ }
+
+ // check that the symbol was defined
+ if(!omit_module_check){
+ // pass in false so we can give better error
+ module = this.findModule(modulename, false);
+ if(!module){
+ dojo.raise("symbol '" + modulename + "' is not defined after loading '" + relpath + "'");
+ }
+ }
+
+ return module;
+}
+
+/**
+* startPackage("A.B") follows the path, and at each level creates a new empty
+* object or uses what already exists. It returns the result.
+*/
+dojo.hostenv.startPackage = function(packname){
+ var syms = packname.split(/\./);
+ if(syms[syms.length-1]=="*"){
+ syms.pop();
+ }
+ return dojo.evalObjPath(syms.join("."), true);
+}
+
+/**
+ * findModule("A.B") returns the object A.B if it exists, otherwise null.
+ * @param modulename A string like 'A.B'.
+ * @param must_exist Optional, defualt false. throw instead of returning null
+ * if the module does not currently exist.
+ */
+dojo.hostenv.findModule = function(modulename, must_exist) {
+ // check cache
+ /*
+ if(!dj_undef(modulename, this.modules_)){
+ return this.modules_[modulename];
+ }
+ */
+
+ var lmn = (new String(modulename)).toLowerCase();
+
+ if(this.loaded_modules_[lmn]){
+ return this.loaded_modules_[lmn];
+ }
+
+ // see if symbol is defined anyway
+ var module = dojo.evalObjPath(modulename);
+ if((modulename)&&(typeof module != 'undefined')&&(module)){
+ this.loaded_modules_[lmn] = module;
+ return module;
+ }
+
+ if(must_exist){
+ dojo.raise("no loaded module named '" + modulename + "'");
+ }
+ return null;
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/bootstrap2.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/bootstrap2.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/bootstrap2.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/bootstrap2.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2004-2005, 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
+*/
+
+/*
+ * bootstrap2.js - runs after the hostenv_*.js file.
+ */
+
+/*
+ * This method taks a "map" of arrays which one can use to optionally load dojo
+ * modules. The map is indexed by the possible dojo.hostenv.name_ values, with
+ * two additional values: "default" and "common". The items in the "default"
+ * array will be loaded if none of the other items have been choosen based on
+ * the hostenv.name_ item. The items in the "common" array will _always_ be
+ * loaded, regardless of which list is chosen. Here's how it's normally
+ * called:
+ *
+ * dojo.hostenv.conditionalLoadModule({
+ * browser: [
+ * ["foo.bar.baz", true, true], // an example that passes multiple args to loadModule()
+ * "foo.sample.*",
+ * "foo.test,
+ * ],
+ * default: [ "foo.sample.*" ],
+ * common: [ "really.important.module.*" ]
+ * });
+ */
+dojo.hostenv.conditionalLoadModule = function(modMap){
+ var common = modMap["common"]||[];
+ var result = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);
+
+ for(var x=0; x<result.length; x++){
+ var curr = result[x];
+ if(curr.constructor == Array){
+ dojo.hostenv.loadModule.apply(dojo.hostenv, curr);
+ }else{
+ dojo.hostenv.loadModule(curr);
+ }
+ }
+}
+
+dojo.hostenv.require = dojo.hostenv.loadModule;
+dojo.require = function(){
+ dojo.hostenv.loadModule.apply(dojo.hostenv, arguments);
+}
+dojo.requireAfter = dojo.require;
+
+dojo.requireIf = function(){
+ if((arguments[0] === true)||(arguments[0]=="common")||(dojo.render[arguments[0]].capable)){
+ var args = [];
+ for (var i = 1; i < arguments.length; i++) { args.push(arguments[i]); }
+ dojo.require.apply(dojo, args);
+ }
+}
+
+dojo.requireAfterIf = dojo.requireIf;
+dojo.conditionalRequire = dojo.requireIf;
+
+dojo.kwCompoundRequire = function(){
+ dojo.hostenv.conditionalLoadModule.apply(dojo.hostenv, arguments);
+}
+
+dojo.hostenv.provide = dojo.hostenv.startPackage;
+dojo.provide = function(){
+ return dojo.hostenv.startPackage.apply(dojo.hostenv, arguments);
+}
+
+dojo.setModulePrefix = function(module, prefix){
+ return dojo.hostenv.setModulePrefix(module, prefix);
+}
+
+// stub
+dojo.profile = { start: function(){}, end: function(){}, dump: function(){} };
+
+// determine if an object supports a given method
+// useful for longer api chains where you have to test each object in the chain
+dojo.exists = function(obj, name){
+ var p = name.split(".");
+ for(var i = 0; i < p.length; i++){
+ if(!(obj[p[i]])) return false;
+ obj = obj[p[i]];
+ }
+ return true;
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/browser_debug.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/browser_debug.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/browser_debug.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/browser_debug.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,156 @@
+/*
+ Copyright (c) 2004-2005, 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/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|hostenv.conditionalLoadModule|hostenv.startPackage|hostenv.provide|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|requireAfter)\([\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;
+ }
+ 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=3; 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>");
+ dj_eval = old_dj_eval;
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/ArrayList.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/ArrayList.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/ArrayList.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/ArrayList.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,101 @@
+/*
+ Copyright (c) 2004-2005, 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.ArrayList");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.ArrayList = function(arr){
+ var items = [];
+ if (arr) items = items.concat(arr);
+ this.count = items.length;
+ this.add = function(obj){
+ items.push(obj);
+ this.count = items.length;
+ };
+ this.addRange = function(a){
+ if (a.getIterator) {
+ var e = a.getIterator();
+ while (!e.atEnd) {
+ this.add(e.current);
+ e.moveNext();
+ }
+ this.count = items.length;
+ } else {
+ for (var i=0; i<a.length; i++){
+ items.push(a[i]);
+ }
+ this.count = items.length;
+ }
+ };
+ this.clear = function(){
+ items.splice(0, items.length);
+ this.count = 0;
+ };
+ this.clone = function(){
+ return new dojo.collections.ArrayList(items);
+ };
+ this.contains = function(obj){
+ for (var i = 0; i < items.length; i++){
+ if (items[i] == obj) {
+ return true;
+ }
+ }
+ return false;
+ };
+ this.getIterator = function(){
+ return new dojo.collections.Iterator(items);
+ };
+ this.indexOf = function(obj){
+ for (var i = 0; i < items.length; i++){
+ if (items[i] == obj) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ this.insert = function(i, obj){
+ items.splice(i,0,obj);
+ this.count = items.length;
+ };
+ this.item = function(k){
+ return items[k];
+ };
+ this.remove = function(obj){
+ var i = this.indexOf(obj);
+ if (i >=0) {
+ items.splice(i,1);
+ }
+ this.count = items.length;
+ };
+ this.removeAt = function(i){
+ items.splice(i,1);
+ this.count = items.length;
+ };
+ this.reverse = function(){
+ items.reverse();
+ };
+ this.sort = function(fn){
+ if (fn){
+ items.sort(fn);
+ } else {
+ items.sort();
+ }
+ };
+ this.setByIndex = function(i, obj){
+ items[i]=obj;
+ this.count=items.length;
+ };
+ this.toArray = function(){
+ return [].concat(items);
+ }
+ this.toString = function(){
+ return items.join(",");
+ };
+};
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/BinaryTree.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/BinaryTree.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/BinaryTree.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/BinaryTree.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,200 @@
+/*
+ Copyright (c) 2004-2005, 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.BinaryTree");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.BinaryTree = function(data){
+ function node(data, rnode, lnode){
+ this.value = data || null;
+ this.right = rnode || null;
+ this.left = lnode || null;
+ this.clone = function(){
+ var c = new node();
+ if (this.value.value) c.value = this.value.clone();
+ else c.value = this.value;
+ if (this.left) c.left = this.left.clone();
+ if (this.right) c.right = this.right.clone();
+ }
+ this.compare = function(n){
+ if (this.value > n.value) return 1;
+ if (this.value < n.value) return -1;
+ return 0;
+ }
+ this.compareData = function(d){
+ if (this.value > d) return 1;
+ if (this.value < d) return -1;
+ return 0;
+ }
+ }
+
+ function inorderTraversalBuildup(current, a){
+ if (current){
+ inorderTraversalBuildup(current.left, a);
+ a.add(current);
+ inorderTraversalBuildup(current.right, a);
+ }
+ }
+
+ function preorderTraversal(current, sep){
+ var s = "";
+ if (current){
+ s = current.value.toString() + sep;
+ s += preorderTraversal(current.left, sep);
+ s += preorderTraversal(current.right, sep);
+ }
+ return s;
+ }
+ function inorderTraversal(current, sep){
+ var s = "";
+ if (current){
+ s = inorderTraversal(current.left, sep);
+ s += current.value.toString() + sep;
+ s += inorderTraversal(current.right, sep);
+ }
+ return s;
+ }
+ function postorderTraversal(current, sep){
+ var s = "";
+ if (current){
+ s = postorderTraversal(current.left, sep);
+ s += postorderTraversal(current.right, sep);
+ s += current.value.toString() + sep;
+ }
+ return s;
+ }
+
+ function searchHelper(current, data){
+ if (!current) return null;
+ var i = current.compareData(data);
+ if (i == 0) return current;
+ if (result > 0) return searchHelper(current.left, data);
+ else return searchHelper(current.right, data);
+ }
+
+ this.add = function(data){
+ var n = new node(data);
+ var i;
+ var current = root;
+ var parent = null;
+ while (current){
+ i = current.compare(n);
+ if (i == 0) return;
+ parent = current;
+ if (i > 0) current = current.left;
+ else current = current.right;
+ }
+ this.count++;
+ if (!parent) root = n;
+ else {
+ i = parent.compare(n);
+ if (i > 0) parent.left = n;
+ else parent.right = n;
+ }
+ };
+ this.clear = function(){
+ root = null;
+ this.count = 0;
+ };
+ this.clone = function(){
+ var c = new dojo.collections.BinaryTree();
+ c.root = root.clone();
+ c.count = this.count;
+ return c;
+ };
+ this.contains = function(data){
+ return this.search(data) != null;
+ };
+ this.deleteData = function(data){
+ var current = root;
+ var parent = null;
+ var i = current.compareData(data);
+ while (i != 0 && current != null){
+ if (i > 0){
+ parent = current;
+ current = current.left;
+ } else if (i < 0) {
+ parent = current;
+ current = current.right;
+ }
+ i = current.compareData(data);
+ }
+ if (!current) return;
+ this.count--;
+ if (!current.right) {
+ if (!parent) root = current.left;
+ else {
+ i = parent.compare(current);
+ if (i > 0) parent.left = current.left;
+ else if (i < 0) parent.right = current.left;
+ }
+ } else if (!current.right.left){
+ if (!parent) root = current.right;
+ else {
+ i = parent.compare(current);
+ if (i > 0) parent.left = current.right;
+ else if (i < 0) parent.right = current.right;
+ }
+ } else {
+ var leftmost = current.right.left;
+ var lmParent = current.right;
+ while (leftmost.left != null){
+ lmParent = leftmost;
+ leftmost = leftmost.left;
+ }
+ lmParent.left = leftmost.right;
+ leftmost.left = current.left;
+ leftmost.right = current.right;
+ if (!parent) root = leftmost;
+ else {
+ i = parent.compare(current);
+ if (i > 0) parent.left = leftmost;
+ else if (i < 0) parent.right = leftmost;
+ }
+ }
+ };
+ this.getIterator = function(){
+ var a = new ArrayList();
+ inorderTraversalBuildup(root, a);
+ return a.getIterator();
+ };
+ this.search = function(data){
+ return searchHelper(root, data);
+ };
+ this.toString = function(order, sep){
+ if (!order) var order = dojo.collections.BinaryTree.TraversalMethods.Inorder;
+ if (!sep) var sep = " ";
+ var s = "";
+ switch (order){
+ case dojo.collections.BinaryTree.TraversalMethods.Preorder:
+ s = preorderTraversal(root, sep);
+ break;
+ case dojo.collections.BinaryTree.TraversalMethods.Inorder:
+ s = inorderTraversal(root, sep);
+ break;
+ case dojo.collections.BinaryTree.TraversalMethods.Postorder:
+ s = postorderTraversal(root, sep);
+ break;
+ };
+ if (s.length == 0) return "";
+ else return s.substring(0, s.length - sep.length);
+ };
+
+ this.count = 0;
+ var root = this.root = null;
+ if (data) {
+ this.add(data);
+ }
+}
+dojo.collections.BinaryTree.TraversalMethods = {
+ Preorder : 0,
+ Inorder : 1,
+ Postorder : 2
+};
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/ByteArray.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/ByteArray.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/ByteArray.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/ByteArray.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,19 @@
+/*
+ Copyright (c) 2004-2005, 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.ByteArray");
+dojo.require("dojo.collections.Collections");
+
+// the following is an implementation of a 32 bit Byte Array.
+dojo.collections.ByteArray = function(s){
+
+
+
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Collections.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Collections.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Collections.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Collections.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,74 @@
+/*
+ Copyright (c) 2004-2005, 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.Collections");
+
+dojo.collections = {Collections:true};
+dojo.collections.DictionaryEntry = function(k,v){
+ this.key = k;
+ this.value = v;
+ this.valueOf = function(){ return this.value; };
+ this.toString = function(){ return this.value; };
+}
+
+dojo.collections.Iterator = function(a){
+ var obj = a;
+ var position = 0;
+ this.atEnd = (position>=obj.length-1);
+ this.current = obj[position];
+ this.moveNext = function(){
+ if(++position>=obj.length){
+ this.atEnd = true;
+ }
+ if(this.atEnd){
+ return false;
+ }
+ this.current=obj[position];
+ return true;
+ }
+ this.reset = function(){
+ position = 0;
+ this.atEnd = false;
+ this.current = obj[position];
+ }
+}
+
+dojo.collections.DictionaryIterator = function(obj){
+ var arr = [] ; // Create an indexing array
+ for (var p in obj) arr.push(obj[p]) ; // fill it up
+ var position = 0 ;
+ this.atEnd = (position>=arr.length-1);
+ this.current = arr[position]||null ;
+ this.entry = this.current||null ;
+ this.key = (this.entry)?this.entry.key:null ;
+ this.value = (this.entry)?this.entry.value:null ;
+ this.moveNext = function() {
+ if (++position>=arr.length) {
+ this.atEnd = true ;
+ }
+ if(this.atEnd){
+ return false;
+ }
+ this.entry = this.current = arr[position] ;
+ if (this.entry) {
+ this.key = this.entry.key ;
+ this.value = this.entry.value ;
+ }
+ return true;
+ } ;
+ this.reset = function() {
+ position = 0 ;
+ this.atEnd = false ;
+ this.current = arr[position]||null ;
+ this.entry = this.current||null ;
+ this.key = (this.entry)?this.entry.key:null ;
+ this.value = (this.entry)?this.entry.value:null ;
+ } ;
+};
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Dictionary.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Dictionary.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Dictionary.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Dictionary.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,76 @@
+/*
+ Copyright (c) 2004-2005, 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.Dictionary");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.Dictionary = function(dictionary){
+ var items = {};
+ this.count = 0;
+
+ this.add = function(k,v){
+ items[k] = new dojo.collections.DictionaryEntry(k,v);
+ this.count++;
+ };
+ this.clear = function(){
+ items = {};
+ this.count = 0;
+ };
+ this.clone = function(){
+ return new dojo.collections.Dictionary(this);
+ };
+ this.contains = this.containsKey = function(k){
+ return (items[k] != null);
+ };
+ this.containsValue = function(v){
+ var e = this.getIterator();
+ while (!e.atEnd) {
+ if (e.value == v) return true;
+ e.moveNext();
+ }
+ return false;
+ };
+ this.getKeyList = function(){
+ var arr = [];
+ var e = this.getIterator();
+ while (!e.atEnd) {
+ arr.push(e.key);
+ e.moveNext();
+ }
+ return arr;
+ };
+ this.getValueList = function(){
+ var arr = [];
+ var e = this.getIterator();
+ while (!e.atEnd) {
+ arr.push(e.value);
+ e.moveNext();
+ }
+ return arr;
+ };
+ this.item = function(k){
+ return items[k];
+ };
+ this.getIterator = function(){
+ return new dojo.collections.DictionaryIterator(items);
+ };
+ this.remove = function(k){
+ delete items[k];
+ this.count--;
+ };
+
+ if (dictionary){
+ var e = dictionary.getIterator();
+ while (!e.atEnd) {
+ this.add(e.key, e.value);
+ e.moveNext();
+ }
+ }
+};
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Graph.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Graph.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Graph.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Graph.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,142 @@
+/*
+ Copyright (c) 2004-2005, 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.Graph");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.Graph = function(nodes){
+ function node(key, data, neighbors) {
+ this.key = key;
+ this.data = data;
+ this.neighbors = neighbors || new adjacencyList();
+ this.addDirected = function(){
+ if (arguments[0].constructor == edgeToNeighbor){
+ this.neighbors.add(arguments[0]);
+ } else {
+ var n = arguments[0];
+ var cost = arguments[1] || 0;
+ this.neighbors.add(new edgeToNeighbor(n, cost));
+ }
+ }
+ }
+ function nodeList(){
+ var d = new dojo.collections.Dictionary();
+ function nodelistiterator(){
+ var o = [] ; // Create an indexing array
+ var e = d.getIterator();
+ while (e.moveNext()) o[o.length] = e.current;
+
+ var position = 0 ;
+ this.current = null ;
+ this.entry = null ;
+ this.key = null ;
+ this.value = null ;
+ this.atEnd = false ;
+ this.moveNext = function() {
+ if (this.atEnd) return !this.atEnd ;
+ this.entry = this.current = o[position] ;
+ if (this.entry) {
+ this.key = this.entry.key ;
+ this.value = this.entry.data ;
+ }
+ if (position == o.length) this.atEnd = true ;
+ position++ ;
+ return !this.atEnd ;
+ } ;
+ this.reset = function() {
+ position = 0 ;
+ this.atEnd = false ;
+ } ;
+ }
+
+ this.add = function(node){
+ d.add(node.key, node);
+ };
+ this.clear = function(){
+ d.clear();
+ };
+ this.containsKey = function(key){
+ return d.containsKey(key);
+ };
+ this.getIterator = function(){
+ return new nodelistiterator(this);
+ };
+ this.item = function(key){
+ return d.item(key);
+ };
+ this.remove = function(node){
+ d.remove(node.key);
+ };
+ }
+ function edgeToNeighbor(node, cost){
+ this.neighbor = node;
+ this.cost = cost;
+ }
+ function adjacencyList(){
+ var d = [];
+ this.add = function(o){
+ d.push(o);
+ };
+ this.item = function(i){
+ return d[i];
+ };
+ this.getIterator = function(){
+ return new dojo.collections.Iterator([].concat(d));
+ };
+ }
+
+ this.nodes = nodes || new nodeList();
+ this.count = this.nodes.count;
+ this.clear = function(){
+ this.nodes.clear();
+ this.count = 0;
+ };
+ this.addNode = function(){
+ var n = arguments[0];
+ if (arguments.length > 1) {
+ n = new node(arguments[0], arguments[1]);
+ }
+ if (!this.nodes.containsKey(n.key)) {
+ this.nodes.add(n);
+ this.count++;
+ }
+ };
+ this.addDirectedEdge = function(uKey, vKey, cost){
+ var uNode, vNode;
+ if (uKey.constructor != node) {
+ uNode = this.nodes.item(uKey);
+ vNode = this.nodes.item(vKey);
+ } else {
+ uNode = uKey;
+ vNode = vKey;
+ }
+ var c = cost || 0;
+ uNode.addDirected(vNode, c);
+ };
+ this.addUndirectedEdge = function(uKey, vKey, cost){
+ var uNode, vNode;
+ if (uKey.constructor != node) {
+ uNode = this.nodes.item(uKey);
+ vNode = this.nodes.item(vKey);
+ } else {
+ uNode = uKey;
+ vNode = vKey;
+ }
+ var c = cost || 0;
+ uNode.addDirected(vNode, c);
+ vNode.addDirected(uNode, c);
+ };
+ this.contains = function(n){
+ return this.nodes.containsKey(n.key);
+ };
+ this.containsKey = function(k){
+ return this.nodes.containsKey(k);
+ };
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/List.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/List.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/List.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/List.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,17 @@
+/*
+ Copyright (c) 2004-2005, 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.List");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.List = function(dictionary){
+ dojo.deprecated("dojo.collections.List", "Use dojo.collections.Dictionary instead.");
+ return new dojo.collections.Dictionary(dictionary);
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Queue.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Queue.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Queue.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Queue.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,51 @@
+/*
+ Copyright (c) 2004-2005, 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.Queue");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.Queue = function(arr){
+ var q = [];
+ if (arr) q = q.concat(arr);
+ this.count = q.length;
+ this.clear = function(){
+ q = [];
+ this.count = q.length;
+ };
+ this.clone = function(){
+ return new dojo.collections.Queue(q);
+ };
+ this.contains = function(o){
+ for (var i = 0; i < q.length; i++){
+ if (q[i] == o) return true;
+ }
+ return false;
+ };
+ this.copyTo = function(arr, i){
+ arr.splice(i,0,q);
+ };
+ this.dequeue = function(){
+ var r = q.shift();
+ this.count = q.length;
+ return r;
+ };
+ this.enqueue = function(o){
+ this.count = q.push(o);
+ };
+ this.getIterator = function(){
+ return new dojo.collections.Iterator(q);
+ };
+ this.peek = function(){
+ return q[0];
+ };
+ this.toArray = function(){
+ return [].concat(q);
+ };
+};
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Set.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Set.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Set.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Set.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2004-2005, 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.Set");
+dojo.require("dojo.collections.Collections");
+dojo.require("dojo.collections.ArrayList");
+
+// straight up sets are based on arrays or array-based collections.
+dojo.collections.Set = new function(){
+ this.union = function(setA, setB){
+ if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA);
+ if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB);
+ if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections.");
+ var result = new dojo.collections.ArrayList(setA.toArray());
+ var e = setB.getIterator();
+ while (!e.atEnd){
+ if (!result.contains(e.current)) result.add(e.current);
+ }
+ return result;
+ };
+ this.intersection = function(setA, setB){
+ if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA);
+ if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB);
+ if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections.");
+ var result = new dojo.collections.ArrayList();
+ var e = setB.getIterator();
+ while (!e.atEnd){
+ if (setA.contains(e.current)) result.add(e.current);
+ e.moveNext();
+ }
+ return result;
+ };
+ // returns everything in setA that is not in setB.
+ this.difference = function(setA, setB){
+ if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA);
+ if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB);
+ if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections.");
+ var result = new dojo.collections.ArrayList();
+ var e = setA.getIterator();
+ while (!e.atEnd){
+ if (!setB.contains(e.current)) result.add(e.current);
+ e.moveNext();
+ }
+ return result;
+ };
+ this.isSubSet = function(setA, setB) {
+ if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA);
+ if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB);
+ if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections.");
+ var e = setA.getIterator();
+ while (!e.atEnd){
+ if (!setB.contains(e.current)) return false;
+ e.moveNext();
+ }
+ return true;
+ };
+ this.isSuperSet = function(setA, setB){
+ if (setA.constructor == Array) var setA = new dojo.collections.ArrayList(setA);
+ if (setB.constructor == Array) var setB = new dojo.collections.ArrayList(setB);
+ if (!setA.toArray || !setB.toArray) dojo.raise("Set operations can only be performed on array-based collections.");
+ var e = setB.getIterator();
+ while (!e.atEnd){
+ if (!setA.contains(e.current)) return false;
+ e.moveNext();
+ }
+ return true;
+ };
+}();
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/SkipList.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/SkipList.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/SkipList.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/SkipList.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,143 @@
+/*
+ Copyright (c) 2004-2005, 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.SkipList");
+dojo.require("dojo.collections.Collections");
+
+dojo.collections.SkipList = function(){
+ function node(height, val){
+ this.value = val;
+ this.height = height;
+ this.nodes = new nodeList(height);
+ this.compare = function(val){
+ if (this.value > val) return 1;
+ if (this.value < val) return -1;
+ return 0;
+ }
+ this.incrementHeight = function(){
+ this.nodes.incrementHeight();
+ this.height++;
+ };
+ this.decrementHeight = function(){
+ this.nodes.decrementHeight();
+ this.height--;
+ };
+ }
+ function nodeList(height){
+ var arr = [];
+ this.height = height;
+ for (var i = 0; i < height; i++) arr[i] = null;
+ this.item = function(i){
+ return arr[i];
+ };
+ this.incrementHeight = function(){
+ this.height++;
+ arr[this.height] = null;
+ };
+ this.decrementHeight = function(){
+ arr.splice(arr.length - 1, 1);
+ this.height--;
+ };
+ }
+ function iterator(list){
+ this.current = list.head;
+ this.atEnd = false;
+ this.moveNext = function(){
+ if (this.atEnd) return !this.atEnd;
+ this.current = this.current.nodes[0];
+ this.atEnd = (current == null);
+ return !this.atEnd;
+ };
+ this.reset = function(){
+ this.current = null;
+ };
+ }
+
+ function chooseRandomHeight(max){
+ var level = 1;
+ while (Math.random() < PROB && level < max) level++;
+ return level;
+ }
+
+ var PROB = 0.5;
+ var comparisons = 0;
+
+ this.head = new node(1);
+ this.count = 0;
+ this.add = function(val){
+ var updates = [];
+ var current = this.head;
+ for (var i = this.head.height; i >= 0; i--){
+ if (!(current.nodes[i] != null && current.nodes[i].compare(val) < 0)) comparisons++;
+ while (current.nodes[i] != null && current.nodes[i].compare(val) < 0){
+ current = current.nodes[i];
+ comparisons++;
+ }
+ updates[i] = current;
+ }
+ if (current.nodes[0] != null && current.nodes[0].compare(val) == 0) return;
+ var n = new node(val, chooseRandomHeight(head.height + 1));
+ this.count++;
+ if (n.height > head.height){
+ head.incrementHeight();
+ head.nodes[head.height - 1] = n;
+ }
+ for (i = 0; i < n.height; i++){
+ if (i < updates.length) {
+ n.nodes[i] = updates[i].nodes[i];
+ updates[i].nodes[i] = n;
+ }
+ }
+ };
+
+ this.contains = function(val){
+ var current = this.head;
+ var i;
+ for (i = head.height - 1; i >= 0; i--) {
+ while (current.item(i) != null) {
+ comparisons++;
+ var result = current.nodes[i].compare(val);
+ if (result == 0) return true;
+ else if (result < 0) current = current.nodes[i];
+ else break;
+ }
+ }
+ return false;
+ };
+ this.getIterator = function(){
+ return new iterator(this);
+ };
+
+ this.remove = function(val){
+ var updates = [];
+ var current = this.head;
+ for (var i = this.head.height - 1; i >= 0; i--){
+ if (!(current.nodes[i] != null && current.nodes[i].compare(val) < 0)) comparisons++;
+ while (current.nodes[i] != null && current.nodes[i].compare(val) < 0) {
+ current = current.nodes[i];
+ comparisons++;
+ }
+ updates[i] = current;
+ }
+
+ current = current.nodes[0];
+ if (current != null && current.compare(val) == 0){
+ this.count--;
+ for (var i = 0; i < head.height; i++){
+ if (updates[i].nodes[i] != current) break;
+ else updates[i].nodes[i] = current.nodes[i];
+ }
+ if (head.nodes[head.height - 1] == null) head.decrementHeight();
+ }
+ };
+ this.resetComparisons = function(){
+ comparisons = 0;
+ };
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/SortedList.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/SortedList.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/SortedList.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/SortedList.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,141 @@
+/*
+ Copyright (c) 2004-2005, 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(dictionary){
+ 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.entry);
+ e.moveNext();
+ }
+ q.sort(sorter);
+ };
+
+ this.count = q.length;
+ this.add = function(k,v){
+ if (!items[k]) {
+ items[k] = new dojo.collections.DictionaryEntry(k,v);
+ this.count = q.push(items[k]);
+ q.sort(sorter);
+ }
+ };
+ this.clear = function(){
+ items = {};
+ q = [];
+ this.count = q.length;
+ };
+ this.clone = function(){
+ return new dojo.collections.SortedList(this);
+ };
+ this.contains = this.containsKey = function(k){
+ return (items[k] != null);
+ };
+ this.containsValue = function(o){
+ var e = this.getIterator();
+ while (!e.atEnd){
+ if (e.value == o) return true;
+ e.moveNext();
+ }
+ return false;
+ };
+ this.copyTo = function(arr, i){
+ var e = this.getIterator();
+ var idx = i;
+ while (!e.atEnd){
+ arr.splice(idx, 0, e.entry);
+ idx++;
+ e.moveNext();
+ }
+ };
+ this.getByIndex = function(i){
+ return q[i].value;
+ };
+ this.getIterator = function(){
+ return new dojo.collections.DictionaryIterator(items);
+ };
+ this.getKey = function(i){
+ return q[i].key;
+ };
+ this.getKeyList = function(){
+ var arr = [];
+ var e = this.getIterator();
+ while (!e.atEnd){
+ arr.push(e.key);
+ e.moveNext();
+ }
+ return arr;
+ };
+ this.getValueList = function(){
+ var arr = [];
+ var e = this.getIterator();
+ while (!e.atEnd){
+ arr.push(e.value);
+ e.moveNext();
+ }
+ return arr;
+ };
+ this.indexOfKey = function(k){
+ for (var i = 0; i < q.length; i++){
+ if (q[i].key == k) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ this.indexOfValue = function(o){
+ for (var i = 0; i < q.length; i++){
+ if (q[i].value == o) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ this.item = function(k){
+ return items[k];
+ };
+
+ this.remove = function(k){
+ delete items[k];
+ build();
+ this.count = q.length;
+ };
+ this.removeAt = function(i){
+ delete items[q[i].key];
+ build();
+ this.count = q.length;
+ };
+
+ this.setByIndex = function(i,o){
+ items[q[i].key].value = o;
+ build();
+ this.count = q.length;
+ };
+
+ if (dictionary){
+ var e = dictionary.getIterator();
+ while (!e.atEnd) {
+ q[q.length] = items[e.key] = new dojo.collections.DictionaryEntry(e.key, e.value);
+ e.moveNext();
+ }
+ q.sort(sorter);
+ }
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Stack.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Stack.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Stack.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/Stack.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,51 @@
+/*
+ Copyright (c) 2004-2005, 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(arr){
+ var q = [];
+ if (arr) q = q.concat(arr);
+ this.count = q.length;
+ this.clear = function(){
+ q = [];
+ this.count = q.length;
+ };
+ this.clone = function(){
+ return new dojo.collections.Stack(q);
+ };
+ this.contains = function(o){
+ for (var i = 0; i < q.length; i++){
+ if (q[i] == o) return true;
+ }
+ return false;
+ };
+ this.copyTo = function(arr, i){
+ arr.splice(i,0,q);
+ };
+ this.getIterator = function(){
+ return new dojo.collections.Iterator(q);
+ };
+ this.peek = function(){
+ return q[(q.length - 1)];
+ };
+ this.pop = function(){
+ var r = q.pop();
+ this.count = q.length;
+ return r;
+ };
+ this.push = function(o){
+ this.count = q.push(o);
+ };
+ this.toArray = function(){
+ return [].concat(q);
+ };
+}
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/__package__.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/__package__.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/__package__.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/collections/__package__.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,22 @@
+/*
+ Copyright (c) 2004-2005, 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.conditionalLoadModule({
+ common: [
+ "dojo.collections.Collections",
+ "dojo.collections.SortedList",
+ "dojo.collections.Dictionary",
+ "dojo.collections.Queue",
+ "dojo.collections.ArrayList",
+ "dojo.collections.Stack",
+ "dojo.collections.Set"
+ ]
+});
+dojo.hostenv.moduleLoaded("dojo.collections.*");
Added: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/crypto.js
URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/crypto.js?rev=393978&view=auto
==============================================================================
--- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/crypto.js (added)
+++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/static/dojo/src/crypto.js Thu Apr 13 16:46:55 2006
@@ -0,0 +1,15 @@
+/*
+ Copyright (c) 2004-2005, 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");
+
+// enumerations for use in crypto code. Note that 0 == default, for the most part.
+dojo.crypto.cipherModes={ ECB:0, CBC:1, PCBC:2, CFB:3, OFB:4, CTR:5 };
+dojo.crypto.outputTypes={ Base64:0,Hex:1,String:2,Raw:3 };
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org