You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by he...@apache.org on 2006/11/13 23:55:14 UTC
svn commit: r474551 [5/49] - in
/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo:
./ src/ src/alg/ src/animation/ src/cal/ src/charting/ src/charting/svg/
src/charting/vml/ src/collections/ src/crypto/ src/data/ src/data/csv...
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/flash6_gateway.swf
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/flash6_gateway.swf?view=auto&rev=474551
==============================================================================
Binary file - no diff available.
Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/flash6_gateway.swf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/iframe_history.html
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/iframe_history.html?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/iframe_history.html (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/iframe_history.html Mon Nov 13 14:54:45 2006
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
+ <script type="text/javascript">
+ // <!--
+ var noInit = false;
+ var domain = "";
+ // document.domain = "localhost";
+ function init(){
+ // parse the query string if there is one to try to get args that
+ // we can act on
+ var sparams = document.location.search;
+ if(sparams.length >= 0){
+ if(sparams.charAt(0) == "?"){
+ sparams = sparams.substring(1);
+ }
+ var ss = (sparams.indexOf("&") >= 0) ? "&" : "&";
+ sparams = sparams.split(ss);
+ for(var x=0; x<sparams.length; x++){
+ var tp = sparams[x].split("=");
+ if(typeof window[tp[0]] != "undefined"){
+ window[tp[0]] = ((tp[1]=="true")||(tp[1]=="false")) ? eval(tp[1]) : tp[1];
+ }
+ }
+ }
+
+ if(noInit){ return; }
+ if(domain.length > 0){
+ document.domain = domain;
+ }
+ if((window.parent != window)&&(window.parent["dojo"])){
+ //Set the page title so IE history shows up with a somewhat correct name.
+ document.title = window.parent.document.title;
+
+ //Notify parent that we are loaded.
+ var pdj = window.parent.dojo;
+ if(pdj["undo"] && pdj["undo"]["browser"]){
+ pdj.undo.browser.iframeLoaded(null, window.location);
+ }
+ }
+ }
+ // -->
+ </script>
+</head>
+<body onload="try{ init(); }catch(e){ alert(e); }">
+ <h4>The Dojo Toolkit -- iframe_history.html</h4>
+
+ <p>This file is used in Dojo's back/fwd button management.</p>
+</body>
+</html>
Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/iframe_history.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js Mon Nov 13 14:54:45 2006
@@ -0,0 +1,89 @@
+/*
+ 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.AdapterRegistry");
+dojo.require("dojo.lang.func");
+
+dojo.AdapterRegistry = function(/*boolean, optional*/returnWrappers){
+ // summary:
+ // A registry to make contextual calling/searching easier.
+ // description:
+ // Objects of this class keep list of arrays in the form [name, check,
+ // wrap, directReturn] that are used to determine what the contextual
+ // result of a set of checked arguments is. All check/wrap functions
+ // in this registry should be of the same arity.
+ this.pairs = [];
+ this.returnWrappers = returnWrappers || false;
+}
+
+dojo.lang.extend(dojo.AdapterRegistry, {
+ register: function( /*string*/ name, /*function*/ check, /*function*/ wrap,
+ /*boolean, optional*/ directReturn,
+ /*boolean, optional*/ override){
+ // summary:
+ // register a check function to determine if the wrap function or
+ // object gets selected
+ // name: a way to identify this matcher.
+ // check:
+ // a function that arguments are passed to from the adapter's
+ // match() function. The check function should return true if the
+ // given arguments are appropriate for the wrap function.
+ // directReturn:
+ // If directReturn is true, the value passed in for wrap will be
+ // returned instead of being called. Alternately, the
+ // AdapterRegistry can be set globally to "return not call" using
+ // the returnWrappers property. Either way, this behavior allows
+ // the registry to act as a "search" function instead of a
+ // function interception library.
+ // override:
+ // If override is given and true, the check function will be given
+ // highest priority. Otherwise, it will be the lowest priority
+ // adapter.
+
+ var type = (override) ? "unshift" : "push";
+ this.pairs[type]([name, check, wrap, directReturn]);
+ },
+
+ match: function(/* ... */){
+ // summary:
+ // Find an adapter for the given arguments. If no suitable adapter
+ // is found, throws an exception. match() accepts any number of
+ // arguments, all of which are passed to all matching functions
+ // from the registered pairs.
+ for(var i = 0; i < this.pairs.length; i++){
+ var pair = this.pairs[i];
+ if(pair[1].apply(this, arguments)){
+ if((pair[3])||(this.returnWrappers)){
+ return pair[2];
+ }else{
+ return pair[2].apply(this, arguments);
+ }
+ }
+ }
+ throw new Error("No match found");
+ // dojo.raise("No match found");
+ },
+
+ unregister: function(name){
+ // summary: Remove a named adapter from the registry
+
+ // FIXME: this is kind of a dumb way to handle this. On a large
+ // registry this will be slow-ish and we can use the name as a lookup
+ // should we choose to trade memory for speed.
+ for(var i = 0; i < this.pairs.length; i++){
+ var pair = this.pairs[i];
+ if(pair[0] == name){
+ this.pairs.splice(i, 1);
+ return true;
+ }
+ }
+ return false;
+ }
+});
Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/AdapterRegistry.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js Mon Nov 13 14:54:45 2006
@@ -0,0 +1,315 @@
+/*
+ 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;
+ },
+
+ makeCalled: function() {
+ var deferred = new dojo.Deferred();
+ deferred.callback();
+ return deferred;
+ },
+
+ 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: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/Deferred.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js Mon Nov 13 14:54:45 2006
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.Deferred");
+
+dojo.provide("dojo.DeferredList");
+
+
+dojo.DeferredList = function (list, /*bool?*/ fireOnOneCallback, /*bool?*/ fireOnOneErrback, /*bool?*/ consumeErrors, /*Function?*/ canceller) {
+ this.list = list;
+ this.resultList = new Array(this.list.length);
+
+ // Deferred init
+ this.chain = [];
+ this.id = this._nextId();
+ this.fired = -1;
+ this.paused = 0;
+ this.results = [null, null];
+ this.canceller = canceller;
+ this.silentlyCancelled = false;
+
+ if (this.list.length === 0 && !fireOnOneCallback) {
+ this.callback(this.resultList);
+ }
+
+ this.finishedCount = 0;
+ this.fireOnOneCallback = fireOnOneCallback;
+ this.fireOnOneErrback = fireOnOneErrback;
+ this.consumeErrors = consumeErrors;
+
+ var index = 0;
+
+ var _this = this;
+
+ dojo.lang.forEach(this.list, function(d) {
+ var _index = index;
+ //dojo.debug("add cb/errb index "+_index);
+ d.addCallback(function(r) { _this._cbDeferred(_index, true, r) });
+ d.addErrback(function(r) { _this._cbDeferred(_index, false, r) });
+ index++;
+ });
+
+};
+
+
+dojo.inherits(dojo.DeferredList, dojo.Deferred);
+
+dojo.lang.extend(dojo.DeferredList, {
+
+ _cbDeferred: function (index, succeeded, result) {
+ //dojo.debug("Fire "+index+" succ "+succeeded+" res "+result);
+ this.resultList[index] = [succeeded, result];
+ this.finishedCount += 1;
+ if (this.fired !== 0) {
+ if (succeeded && this.fireOnOneCallback) {
+ this.callback([index, result]);
+ } else if (!succeeded && this.fireOnOneErrback) {
+ this.errback(result);
+ } else if (this.finishedCount == this.list.length) {
+ this.callback(this.resultList);
+ }
+ }
+ if (!succeeded && this.consumeErrors) {
+ result = null;
+ }
+ return result;
+ },
+
+ gatherResults: function (deferredList) {
+ var d = new dojo.DeferredList(deferredList, false, true, false);
+ d.addCallback(function (results) {
+ var ret = [];
+ for (var i = 0; i < results.length; i++) {
+ ret.push(results[i][1]);
+ }
+ return ret;
+ });
+ return d;
+ }
+});
+
Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/DeferredList.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js Mon Nov 13 14:54:45 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.a11y");
+
+dojo.require("dojo.uri.*");
+dojo.require("dojo.html.common");
+
+dojo.a11y = {
+ // imgPath: String path to the test image for determining if images are displayed or not
+ // doAccessibleCheck: Boolean if true will perform check for need to create accessible widgets
+ // accessible: Boolean uninitialized when null (accessible check has not been performed)
+ // if true generate accessible widgets
+ imgPath:dojo.uri.dojoUri("src/widget/templates/images"),
+ doAccessibleCheck: true,
+ accessible: null,
+
+ checkAccessible: function(){
+ // summary:
+ // perform check for accessibility if accessibility checking is turned
+ // on and the accessibility test has not been performed yet
+ if(this.accessible === null){
+ this.accessible = false; //default
+ if(this.doAccessibleCheck == true){
+ this.accessible = this.testAccessible();
+ }
+ }
+ return this.accessible; /* Boolean */
+ },
+
+ testAccessible: function(){
+ // summary:
+ // Always perform the accessibility check to determine if high
+ // contrast mode is on or display of images are turned off. Currently only checks
+ // in IE and Mozilla.
+ this.accessible = false; //default
+ if (dojo.render.html.ie || dojo.render.html.mozilla){
+ var div = document.createElement("div");
+ //div.style.color="rgb(153,204,204)";
+ div.style.backgroundImage = "url(\"" + this.imgPath + "/tab_close.gif\")";
+ // must add to hierarchy before can view currentStyle below
+ dojo.body().appendChild(div);
+ // in FF and IE the value for the current background style of the added div
+ // will be "none" in high contrast mode
+ // in FF the return value will be url(invalid-url:) when running over http
+ var bkImg = null;
+ if (window.getComputedStyle ) {
+ var cStyle = getComputedStyle(div, "");
+ bkImg = cStyle.getPropertyValue("background-image");
+ }else{
+ bkImg = div.currentStyle.backgroundImage;
+ }
+ var bUseImgElem = false;
+ if (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)" )) {
+ this.accessible = true;
+ }
+ /*
+ if(this.accessible == false && document.images){
+ // test if images are off in IE
+ var testImg = new Image();
+ if(testImg.fileSize) {
+ testImg.src = this.imgPath + "/tab_close.gif";
+ if(testImg.fileSize < 0){
+ this.accessible = true;
+ }
+ }
+ }*/
+ dojo.body().removeChild(div);
+ }
+ return this.accessible; /* Boolean */
+ },
+
+ setCheckAccessible: function(/* Boolean */ bTest){
+ // summary:
+ // Set whether or not to check for accessibility mode. Default value
+ // of module is true - perform check for accessibility modes.
+ // bTest: Boolean - true to check; false to turn off checking
+ this.doAccessibleCheck = bTest;
+ },
+
+ setAccessibleMode: function(){
+ // summary:
+ // perform the accessibility check and sets the correct mode to load
+ // a11y widgets. Only runs if test for accessiiblity has not been performed yet.
+ // Call testAccessible() to force the test.
+ if (this.accessible === null){
+ if (this.checkAccessible()){
+ dojo.render.html.prefixes.unshift("a11y");
+ }
+ }
+ return this.accessible; /* Boolean */
+ }
+};
+
+//dojo.hostenv.modulesLoadedListeners.unshift(function() { dojo.a11y.setAccessibleMode(); });
+//dojo.event.connect("before", dojo.hostenv, "makeWidgets", dojo.a11y, "setAccessibleMode");
Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/a11y.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation.js?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation.js (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation.js Mon Nov 13 14:54:45 2006
@@ -0,0 +1,14 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.animation");
+dojo.require("dojo.animation.Animation");
+
+dojo.deprecated("dojo.animation is slated for removal in 0.5; use dojo.lfx instead.", "0.5");
Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js?view=diff&rev=474551&r1=474550&r2=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js (original)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Animation.js Mon Nov 13 14:54:45 2006
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2005, The Dojo Foundation
+ Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
@@ -8,21 +8,33 @@
http://dojotoolkit.org/community/licensing.shtml
*/
-dojo.provide("dojo.animation");
dojo.provide("dojo.animation.Animation");
+dojo.require("dojo.animation.AnimationEvent");
-dojo.require("dojo.lang");
+dojo.require("dojo.lang.func");
dojo.require("dojo.math");
dojo.require("dojo.math.curves");
+dojo.deprecated("dojo.animation.Animation is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5");
+
/*
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
+dojo.animation.Animation = function(/*dojo.math.curves.* */ curve, /*int*/ duration, /*Decimal?*/ accel, /*int?*/ repeatCount, /*int?*/ rate) {
+ // summary: Animation object iterates a set of numbers over a curve for a given amount of time, calling 'onAnimate' at each step.
+ // curve: Curve to animate over.
+ // duration: Duration of the animation, in milliseconds.
+ // accel: Either an integer or curve representing amount of acceleration. (?) Default is linear acceleration.
+ // repeatCount: Number of times to repeat the animation. Default is 0.
+ // rate: Time between animation steps, in milliseconds. Default is 25.
+ // description: Calls the following events: "onBegin", "onAnimate", "onEnd", "onPlay", "onPause", "onStop"
+ // If the animation implements a "handler" function, that will be called before each event is called.
+
if(dojo.lang.isArray(curve)) {
+ // curve: Array
+ // id: i
curve = new dojo.math.curves.Line(curve[0], curve[1]);
}
this.curve = curve;
@@ -30,7 +42,11 @@
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
@@ -38,6 +54,7 @@
}
}
}
+
dojo.lang.extend(dojo.animation.Animation, {
// public properties
curve: null,
@@ -66,7 +83,12 @@
_startRepeatCount: 0,
// public methods
- play: function(gotoStart) {
+ play: function(/*Boolean?*/ gotoStart) {
+ // summary: Play the animation.
+ // goToStart: If true, will restart the animation from the beginning.
+ // Otherwise, starts from current play counter.
+ // description: Sends an "onPlay" event to any observers.
+ // Also sends an "onBegin" event if starting from the beginning.
if( gotoStart ) {
clearTimeout(this._timer);
this._active = false;
@@ -104,11 +126,13 @@
if(this._animSequence) { this._animSequence._setCurrent(this); }
- //dojo.lang.hitch(this, cycle)();
this._cycle();
},
pause: function() {
+ // summary: Temporarily stop the animation, leaving the play counter at the current location.
+ // Resume later with sequence.play()
+ // description: Sends an "onPause" AnimationEvent to any observers.
clearTimeout(this._timer);
if( !this._active ) { return; }
this._paused = true;
@@ -119,6 +143,7 @@
},
playPause: function() {
+ // summary: Toggle between play and paused states.
if( !this._active || this._paused ) {
this.play();
} else {
@@ -126,7 +151,10 @@
}
},
- gotoPercent: function(pct, andPlay) {
+ gotoPercent: function(/*int*/ pct, /*Boolean*/ andPlay) {
+ // summary: Set the play counter at a certain point in the animation.
+ // pct: Point to set the play counter to, expressed as a percentage (0 to 100).
+ // andPlay: If true, will start the animation at the counter automatically.
clearTimeout(this._timer);
this._active = true;
this._paused = true;
@@ -134,14 +162,17 @@
if( andPlay ) { this.play(); }
},
- stop: function(gotoEnd) {
+ stop: function(/*Boolean?*/ gotoEnd) {
+ // summary: Stop the animation.
+ // gotoEnd: If true, will advance play counter to the end before sending the event.
+ // description: Sends an "onStop" AnimationEvent to any observers.
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));
+ 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;
@@ -149,20 +180,23 @@
},
status: function() {
+ // summary: Return the status of the animation.
+ // description: Returns one of "playing", "paused" or "stopped".
if( this._active ) {
- return this._paused ? "paused" : "playing";
+ return this._paused ? "paused" : "playing"; /* String */
} else {
- return "stopped";
+ return "stopped"; /* String */
}
},
// "private" methods
_cycle: function() {
+ // summary: Perform once 'cycle' or step of the animation.
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);
+ var fps = 1000 / (curr - this._lastFrame);
this._lastFrame = curr;
if( step >= 1 ) {
@@ -205,156 +239,6 @@
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: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js Mon Nov 13 14:54:45 2006
@@ -0,0 +1,64 @@
+/*
+ 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.AnimationEvent");
+dojo.require("dojo.lang.common");
+
+dojo.deprecated("dojo.animation.AnimationEvent is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5");
+
+dojo.animation.AnimationEvent = function(
+ /*dojo.animation.Animation*/ animation,
+ /*String*/type,
+ /*int[] */ coords,
+ /*int*/ startTime,
+ /*int*/ currentTime,
+ /*int*/ endTime,
+ /*int*/ duration,
+ /*int*/ percent,
+ /*int?*/ fps) {
+ // summary: Event sent at various points during an Animation.
+ // animation: Animation throwing the event.
+ // type: One of: "animate", "begin", "end", "play", "pause" or "stop".
+ // coords: Current coordinates of the animation.
+ // startTime: Time the animation was started, as milliseconds.
+ // currentTime: Time the event was thrown, as milliseconds.
+ // endTime: Time the animation is expected to complete, as milliseconds.
+ // duration: Duration of the animation, in milliseconds.
+ // percent: Percent of the animation that has completed, between 0 and 100.
+ // fps: Frames currently shown per second. (Only sent for "animate" event).
+ // description: The AnimationEvent has public properties of the same name as
+ // all constructor arguments, plus "x", "y" and "z".
+
+ this.type = type; // "animate", "begin", "end", "play", "pause", "stop"
+ this.animation = animation;
+
+ this.coords = coords;
+ this.x = coords[0];
+ this.y = coords[1];
+ this.z = coords[2];
+
+ this.startTime = startTime;
+ this.currentTime = currentTime;
+ this.endTime = endTime;
+
+ this.duration = duration;
+ this.percent = percent;
+ this.fps = fps;
+};
+dojo.extend(dojo.animation.AnimationEvent, {
+ coordsAsInts: function() {
+ // summary: Coerce the coordinates into integers.
+ 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;
+ }
+});
Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationEvent.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js Mon Nov 13 14:54:45 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.provide("dojo.animation.AnimationSequence");
+dojo.require("dojo.animation.AnimationEvent");
+dojo.require("dojo.animation.Animation");
+
+dojo.deprecated("dojo.animation.AnimationSequence is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5");
+
+dojo.animation.AnimationSequence = function(/*int?*/ repeatCount){
+ // summary: Sequence of Animations, played one after the other.
+ // repeatCount: Number of times to repeat the entire sequence. Default is 0 (play once only).
+ // description: Calls the following events: "onBegin", "onEnd", "onNext"
+ // If the animation implements a "handler" function, that will be called before each event is called.
+ this._anims = [];
+ this.repeatCount = repeatCount || 0;
+}
+
+dojo.lang.extend(dojo.animation.AnimationSequence, {
+ repeatCount: 0,
+
+ _anims: [],
+ _currAnim: -1,
+
+ onBegin: null,
+ onEnd: null,
+ onNext: null,
+ handler: null,
+
+ add: function() {
+ // summary: Add one or more Animations to the sequence.
+ // description: args: Animations (dojo.animation.Animation) to add to the sequence.
+ for(var i = 0; i < arguments.length; i++) {
+ this._anims.push(arguments[i]);
+ arguments[i]._animSequence = this;
+ }
+ },
+
+ remove: function(/*dojo.animation.Animation*/ anim) {
+ // summary: Remove one particular animation from the sequence.
+ // amim: Animation to remove.
+ 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() {
+ // summary: Remove all animations from the sequence.
+ for(var i = 0; i < this._anims.length; i++) {
+ this._anims[i]._animSequence = null;
+ }
+ this._anims = [];
+ this._currAnim = -1;
+ },
+
+ clear: function() {
+ // summary: Remove all animations from the sequence.
+ this.removeAll();
+ },
+
+ play: function(/*Boolean?*/ gotoStart) {
+ // summary: Play the animation sequence.
+ // gotoStart: If true, will start at the beginning of the first sequence.
+ // Otherwise, starts at the current play counter of the current animation.
+ // description: Sends an "onBegin" event to any observers.
+ 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() {
+ // summary: temporarily stop the current animation. Resume later with sequence.play()
+ if( this._anims[this._currAnim] ) {
+ this._anims[this._currAnim].pause();
+ }
+ },
+
+ playPause: function() {
+ // summary: Toggle between play and paused states.
+ 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() {
+ // summary: Stop the current animation.
+ if( this._anims[this._currAnim] ) {
+ this._anims[this._currAnim].stop();
+ }
+ },
+
+ status: function() {
+ // summary: Return the status of the current animation.
+ // description: Returns one of "playing", "paused" or "stopped".
+ if( this._anims[this._currAnim] ) {
+ return this._anims[this._currAnim].status();
+ } else {
+ return "stopped";
+ }
+ },
+
+ _setCurrent: function(/*dojo.animation.Animation*/ anim) {
+ // summary: Set the current animation.
+ // anim: Animation to make current, must have already been added to the sequence.
+ for(var i = 0; i < this._anims.length; i++) {
+ if( this._anims[i] == anim ) {
+ this._currAnim = i;
+ break;
+ }
+ }
+ },
+
+ _playNext: function() {
+ // summary: Play the next animation in the sequence.
+ // description: Sends an "onNext" event to any observers.
+ // Also sends "onEnd" if the last animation is finished.
+ 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: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/AnimationSequence.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js?view=diff&rev=474551&r1=474550&r2=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js (original)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/Timer.js Mon Nov 13 14:54:45 2006
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2005, The Dojo Foundation
+ Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
@@ -9,31 +9,8 @@
*/
dojo.provide("dojo.animation.Timer");
-dojo.require("dojo.lang");
+dojo.require("dojo.lang.timing.Timer");
-dojo.animation.Timer = function(intvl){
- var timer = null;
- this.isRunning = false;
- this.interval = intvl;
+dojo.deprecated("dojo.animation.Timer is now dojo.lang.timing.Timer", "0.5");
- 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);
- };
-};
+dojo.animation.Timer = dojo.lang.timing.Timer;
Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js?view=diff&rev=474551&r1=474550&r2=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js (original)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/animation/__package__.js Mon Nov 13 14:54:45 2006
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2005, The Dojo Foundation
+ Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
@@ -8,7 +8,13 @@
http://dojotoolkit.org/community/licensing.shtml
*/
-dojo.hostenv.conditionalLoadModule({
- common: ["dojo.animation.Animation", false, false]
+dojo.kwCompoundRequire({
+ common: [
+ "dojo.animation.AnimationEvent",
+ "dojo.animation.Animation",
+ "dojo.animation.AnimationSequence"
+ ]
});
-dojo.hostenv.moduleLoaded("dojo.animation.*");
+dojo.provide("dojo.animation.*");
+
+dojo.deprecated("dojo.Animation.* is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5");
Added: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js?view=auto&rev=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js (added)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js Mon Nov 13 14:54:45 2006
@@ -0,0 +1,248 @@
+/*
+ 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.behavior");
+dojo.require("dojo.event.*");
+
+dojo.require("dojo.experimental");
+dojo.experimental("dojo.behavior");
+
+dojo.behavior = new function(){
+ function arrIn(obj, name){
+ if(!obj[name]){ obj[name] = []; }
+ return obj[name];
+ }
+
+ function forIn(obj, scope, func){
+ var tmpObj = {};
+ for(var x in obj){
+ if(typeof tmpObj[x] == "undefined"){
+ if(!func){
+ scope(obj[x], x);
+ }else{
+ func.call(scope, obj[x], x);
+ }
+ }
+ }
+ }
+
+ // FIXME: need a better test so we don't exclude nightly Safari's!
+ this.behaviors = {};
+ this.add = function(behaviorObj){
+ /* behavior objects are specified in the following format:
+ *
+ * {
+ * "#id": {
+ * "found": function(element){
+ * // ...
+ * },
+ *
+ * "onblah": {targetObj: foo, targetFunc: "bar"},
+ *
+ * "onblarg": "/foo/bar/baz/blarg",
+ *
+ * "onevent": function(evt){
+ * },
+ *
+ * "onotherevent: function(evt){
+ * // ...
+ * }
+ * },
+ *
+ * "#id2": {
+ * // ...
+ * },
+ *
+ * "#id3": function(element){
+ * // ...
+ * },
+ *
+ * // publish the match on a topic
+ * "#id4": "/found/topic/name",
+ *
+ * // match all direct descendants
+ * "#id4 > *": function(element){
+ * // ...
+ * },
+ *
+ * // match the first child node that's an element
+ * "#id4 > @firstElement": { ... },
+ *
+ * // match the last child node that's an element
+ * "#id4 > @lastElement": { ... },
+ *
+ * // all elements of type tagname
+ * "tagname": {
+ * // ...
+ * },
+ *
+ * // maps to roughly:
+ * // dojo.lang.forEach(body.getElementsByTagName("tagname1"), function(node){
+ * // dojo.lang.forEach(node.getElementsByTagName("tagname2"), function(node2){
+ * // dojo.lang.forEach(node2.getElementsByTagName("tagname3", function(node3){
+ * // // apply rules
+ * // });
+ * // });
+ * // });
+ * "tagname1 tagname2 tagname3": {
+ * // ...
+ * },
+ *
+ * ".classname": {
+ * // ...
+ * },
+ *
+ * "tagname.classname": {
+ * // ...
+ * },
+ * }
+ *
+ * The "found" method is a generalized handler that's called as soon
+ * as the node matches the selector. Rules for values that follow also
+ * apply to the "found" key.
+ *
+ * The "on*" handlers are attached with dojo.event.connect(). If the
+ * value is not a function but is rather an object, it's assumed to be
+ * the "other half" of a dojo.event.kwConnect() argument object. It
+ * may contain any/all properties of such a connection modifier save
+ * for the sourceObj and sourceFunc properties which are filled in by
+ * the system automatically. If a string is instead encountered, the
+ * node publishes the specified event on the topic contained in the
+ * string value.
+ *
+ * If the value corresponding to the ID key is a function and not a
+ * list, it's treated as though it was the value of "found".
+ *
+ */
+
+ var tmpObj = {};
+ forIn(behaviorObj, this, function(behavior, name){
+ var tBehavior = arrIn(this.behaviors, name);
+ if((dojo.lang.isString(behavior))||(dojo.lang.isFunction(behavior))){
+ behavior = { found: behavior };
+ }
+ forIn(behavior, function(rule, ruleName){
+ arrIn(tBehavior, ruleName).push(rule);
+ });
+ });
+ }
+
+ this.apply = function(){
+ dojo.profile.start("dojo.behavior.apply");
+ var r = dojo.render.html;
+ // note, we apply one way for fast queries and one way for slow
+ // iteration. So be it.
+ var safariGoodEnough = (!r.safari);
+ if(r.safari){
+ // Anything over release #420 should work the fast way
+ var uas = r.UA.split("AppleWebKit/")[1];
+ if(parseInt(uas.match(/[0-9.]{3,}/)) >= 420){
+ safariGoodEnough = true;
+ }
+ }
+ if((dj_undef("behaviorFastParse", djConfig) ? (safariGoodEnough) : djConfig["behaviorFastParse"])){
+ this.applyFast();
+ }else{
+ this.applySlow();
+ }
+ dojo.profile.end("dojo.behavior.apply");
+ }
+
+ this.matchCache = {};
+
+ this.elementsById = function(id, handleRemoved){
+ var removed = [];
+ var added = [];
+ arrIn(this.matchCache, id);
+ if(handleRemoved){
+ var nodes = this.matchCache[id];
+ for(var x=0; x<nodes.length; x++){
+ if(nodes[x].id != ""){
+ removed.push(nodes[x]);
+ nodes.splice(x, 1);
+ x--;
+ }
+ }
+ }
+ var tElem = dojo.byId(id);
+ while(tElem){
+ if(!tElem["idcached"]){
+ added.push(tElem);
+ }
+ tElem.id = "";
+ tElem = dojo.byId(id);
+ }
+ this.matchCache[id] = this.matchCache[id].concat(added);
+ dojo.lang.forEach(this.matchCache[id], function(node){
+ node.id = id;
+ node.idcached = true;
+ });
+ return { "removed": removed, "added": added, "match": this.matchCache[id] };
+ }
+
+ this.applyToNode = function(node, action, ruleSetName){
+ if(typeof action == "string"){
+ dojo.event.topic.registerPublisher(action, node, ruleSetName);
+ }else if(typeof action == "function"){
+ if(ruleSetName == "found"){
+ action(node);
+ }else{
+ dojo.event.connect(node, ruleSetName, action);
+ }
+ }else{
+ action.srcObj = node;
+ action.srcFunc = ruleSetName;
+ dojo.event.kwConnect(action);
+ }
+ }
+
+ this.applyFast = function(){
+ dojo.profile.start("dojo.behavior.applyFast");
+ // fast DOM queries...wheeee!
+ forIn(this.behaviors, function(tBehavior, id){
+ var elems = dojo.behavior.elementsById(id);
+ dojo.lang.forEach(elems.added,
+ function(elem){
+ forIn(tBehavior, function(ruleSet, ruleSetName){
+ if(dojo.lang.isArray(ruleSet)){
+ dojo.lang.forEach(ruleSet, function(action){
+ dojo.behavior.applyToNode(elem, action, ruleSetName);
+ });
+ }
+ });
+ }
+ );
+ });
+ dojo.profile.end("dojo.behavior.applyFast");
+ }
+
+ this.applySlow = function(){
+ // iterate. Ugg.
+ dojo.profile.start("dojo.behavior.applySlow");
+ var all = document.getElementsByTagName("*");
+ var allLen = all.length;
+ for(var x=0; x<allLen; x++){
+ var elem = all[x];
+ if((elem.id)&&(!elem["behaviorAdded"])&&(this.behaviors[elem.id])){
+ elem["behaviorAdded"] = true;
+ forIn(this.behaviors[elem.id], function(ruleSet, ruleSetName){
+ if(dojo.lang.isArray(ruleSet)){
+ dojo.lang.forEach(ruleSet, function(action){
+ dojo.behavior.applyToNode(elem, action, ruleSetName);
+ });
+ }
+ });
+ }
+ }
+ dojo.profile.end("dojo.behavior.applySlow");
+ }
+}
+
+dojo.addOnLoad(dojo.behavior, "apply");
Propchange: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/behavior.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js?view=diff&rev=474551&r1=474550&r2=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js (original)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap1.js Mon Nov 13 14:54:45 2006
@@ -1,239 +1,228 @@
-/*
- 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.
+* 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)
-* @author Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php
+* @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 2836 2006-01-16 08:36:18Z alex $
+* $Id: bootstrap1.js 6258 2006-10-20 03:12:36Z jburke $
*/
-/**
- * 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:
- */
+// 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
+// - locale: undefined
+// - extraLocale: undefined
+// - 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;
+
+//TODOC: HOW TO DOC THIS?
+// @global: dj_currentContext
+// summary:
+// Private global context object. Where 'dj_global' always refers to the boot-time
+// global context, 'dj_currentContext' can be modified for temporary context shifting.
+// dojo.global() returns dj_currentContext.
+// description:
+// Refer to dojo.global() rather than referring to dj_global to ensure your
+// code runs correctly in managed contexts.
+var dj_currentContext = this;
-/**
- * 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");
+// ****************************************************************
+// global public utils
+// TODOC: DO WE WANT TO NOTE THAT THESE ARE GLOBAL PUBLIC UTILS?
+// ****************************************************************
+
+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.
+ return (typeof (object || dj_currentContext)[name] == "undefined"); // Boolean
}
-if(dj_undef("djConfig")){
- var djConfig = {};
+// make sure djConfig is defined
+if(dj_undef("djConfig", this)){
+ var djConfig = {};
}
-/**
- * dojo is the root variable of (almost all) our public symbols.
- */
-var dojo;
-if(dj_undef("dojo")){ dojo = {}; }
+//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", this)){
+ var 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 + ")";
- }
- }
-};
+dojo.global = function(){
+ // summary:
+ // return the current global context object
+ // (e.g., the window object in a browser).
+ // description:
+ // Refer to 'dojo.global()' rather than referring to window to ensure your
+ // code runs correctly in contexts other than web browsers (eg: Rhino on a server).
+ return dj_currentContext;
+}
-/*
- * 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];
- }
+// Override locale setting, if specified
+dojo.locale = djConfig.locale;
- 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]];
+//TODOC: HOW TO DOC THIS?
+dojo.version = {
+ // summary: version number of this instance of dojo.
+ major: 0, minor: 3, patch: 1, flag: "+",
+ revision: Number("$Rev: 6258 $".match(/[0-9]+/)[0]),
+ toString: function(){
+ with(dojo.version){
+ return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String
}
}
- 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);
+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.
+ if((!object)||(!name)) return undefined; // undefined
+ if(!dj_undef(name, object)) return object[name]; // mixed
+ return (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 'dojo.global()'.
+ // create: If true, Objects will be created at any point along the 'path' that is undefined.
+ var object = (context || dojo.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 dojo.global();
}
- var he = dojo.hostenv;
- if((!dj_undef("hostenv", dojo))&&(!dj_undef("println", dojo.hostenv))){
- dojo.hostenv.println("FATAL: " + message);
+ // fast path for no periods
+ if(path.indexOf('.') == -1){
+ return dojo.evalProp(path, dojo.global(), create); // mixed
}
- 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(" "));
+ //MOW: old 'with' syntax was confusing and would throw an error if parseObjPath returned null.
+ var ref = dojo.parseObjPath(path, dojo.global(), create);
+ if(ref){
+ return dojo.evalProp(ref.prop, ref.obj, create); // mixed
}
+ return null;
}
-/**
- * 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.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.debug('------------------------------------------------------------');
}
-var dj_debug = dojo.debug;
+dojo.raise = function(/*String*/ message, /*Error?*/ exception){
+ // summary: Common point for raising exceptions in Dojo to enable logging.
+ // Throws an error message with text of 'exception' if provided, or
+ // rethrows exception object.
-/**
- * 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); }
+ if(exception){
+ message = message + ": "+dojo.errorToString(exception);
+ }
+ // print the message to the user if hostenv.println is defined
+ try { if(djConfig.isDebug){ dojo.hostenv.println("FATAL exception raised: "+message); } } catch (e) {}
-/**
- * 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);
+ throw exception || Error(message);
}
-/**
- * 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);
+//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
}
-/**
- * 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;
+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);
}
-dj_inherits = function(subclass, superclass){
- dojo.deprecated("dj_inherits deprecated, use dojo.inherits instead");
- dojo.inherits(subclass, superclass);
+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);
}
-// an object that authors use determine what host we are running under
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,
@@ -243,8 +232,8 @@
},
prefixes: prefs
};
- for(var x in names){
- tmp[x] = false;
+ for(var i=0; i<names.length; i++){
+ tmp[names[i]] = false;
}
return tmp;
}
@@ -274,7 +263,12 @@
* 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,
@@ -285,6 +279,7 @@
iePreventClobber: false,
ieClobberMinimal: true,
preventBackButtonFix: true,
+ delayMozLoadingFix: false,
searchIds: [],
parseWidgets: true
};
@@ -298,366 +293,51 @@
}
}
- 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"}
+
+ getName: function(){
+ // sumary: Return the name of the host environment.
+ return this.name_; // String
},
- setModulePrefix: function(module, prefix){
- this.modulePrefixes_[module] = {name: module, value: prefix};
+ getVersion: function(){
+ // summary: Return the version of the hostenv.
+ return this.version_; // String
},
- getModulePrefix: function(module){
- var mp = this.modulePrefixes_;
- if((mp[module])&&(mp[module]["name"])){
- return mp[module].value;
- }
- return module;
- },
+ 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.
- 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(){
+ // 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); }
- var lastslash = uri.lastIndexOf('/');
+ // 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;
-}
-
-/**
-* 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;
+ return djConfig.baseScriptUri; // String
}
Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap2.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap2.js?view=diff&rev=474551&r1=474550&r2=474551
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap2.js (original)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/src/bootstrap2.js Mon Nov 13 14:54:45 2006
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004-2005, The Dojo Foundation
+ Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
@@ -8,83 +8,52 @@
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);
- }
+//Semicolon is for when this file is integrated with a custom build on one line
+//with some other file's contents. Sometimes that makes things not get defined
+//properly, particularly with the using the closure below to do all the work.
+;(function(){
+ //Don't do this work if dojo.js has already done it.
+ if(typeof dj_usingBootstrap != "undefined"){
+ return;
+ }
+
+ var isRhino = false;
+ var isSpidermonkey = false;
+ var isDashboard = false;
+ if((typeof this["load"] == "function")&&((typeof this["Packages"] == "function")||(typeof this["Packages"] == "object"))){
+ isRhino = true;
+ }else if(typeof this["load"] == "function"){
+ isSpidermonkey = true;
+ }else if(window.widget){
+ isDashboard = true;
+ }
+
+ var tmps = [];
+ if((this["djConfig"])&&((djConfig["isDebug"])||(djConfig["debugAtAllCosts"]))){
+ tmps.push("debug.js");
}
-}
-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]];
+ if((this["djConfig"])&&(djConfig["debugAtAllCosts"])&&(!isRhino)&&(!isDashboard)){
+ tmps.push("browser_debug.js");
+ }
+
+ var loaderRoot = djConfig["baseScriptUri"];
+ if((this["djConfig"])&&(djConfig["baseLoaderUri"])){
+ loaderRoot = djConfig["baseLoaderUri"];
+ }
+
+ for(var x=0; x < tmps.length; x++){
+ var spath = loaderRoot+"src/"+tmps[x];
+ if(isRhino||isSpidermonkey){
+ load(spath);
+ } else {
+ try {
+ document.write("<scr"+"ipt type='text/javascript' src='"+spath+"'></scr"+"ipt>");
+ } catch (e) {
+ var script = document.createElement("script");
+ script.src = spath;
+ document.getElementsByTagName("head")[0].appendChild(script);
+ }
+ }
}
- return true;
-}
+})();