Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/dojo.js.uncompressed.js
------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/dojo.js.uncompressed.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/dojo.js.uncompressed.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/flash6_gateway.swf URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/flash6_gateway.swf?view=auto&rev=509273 ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/flash6_gateway.swf ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ofbiz/trunk/framework/images/webapp/images/dojo/iframe_history.html URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/iframe_history.html?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/iframe_history.html (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/iframe_history.html Mon Feb 19 09:56:06 2007 @@ -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: ofbiz/trunk/framework/images/webapp/images/dojo/iframe_history.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/iframe_history.html ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/iframe_history.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/AdapterRegistry.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/AdapterRegistry.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/AdapterRegistry.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/AdapterRegistry.js Mon Feb 19 09:56:06 2007 @@ -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.provide("dojo.AdapterRegistry"); +dojo.require("dojo.lang.func"); + +dojo.AdapterRegistry = function(/*Boolean?*/ 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(name, check, /*Function*/ wrap, directReturn, override){ + // summary: + // register a check function to determine if the wrap function or + // object gets selected + // name: String + // a way to identify this matcher. + // check: Function + // 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: Boolean? + // 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: Boolean? + // 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: ofbiz/trunk/framework/images/webapp/images/dojo/src/AdapterRegistry.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/AdapterRegistry.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/AdapterRegistry.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/Deferred.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/Deferred.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/Deferred.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/Deferred.js Mon Feb 19 09:56:06 2007 @@ -0,0 +1,313 @@ +/* + 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(/*Function?*/ 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(){ + // summary: Cancels a Deferred that has not yet received a value, or is + // waiting on another Deferred as its value. + // description: + // 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(){ + // summary: Used internally to signal that it's waiting on another Deferred + this.paused++; + }, + + _unpause: function(){ + // summary: 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){ + // summary: 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){ + // summary: 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){ + // summary: 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){ + /* summary + 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){ + // summary: 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){ + // summary: 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) { + // summary: 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(){ + // summary: 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: ofbiz/trunk/framework/images/webapp/images/dojo/src/Deferred.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/Deferred.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/Deferred.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/DeferredList.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/DeferredList.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/DeferredList.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/DeferredList.js Mon Feb 19 09:56:06 2007 @@ -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: ofbiz/trunk/framework/images/webapp/images/dojo/src/DeferredList.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/DeferredList.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/DeferredList.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/a11y.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/a11y.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/a11y.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/a11y.js Mon Feb 19 09:56:06 2007 @@ -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: ofbiz/trunk/framework/images/webapp/images/dojo/src/a11y.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/a11y.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/a11y.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/animation.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/animation.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/animation.js Mon Feb 19 09:56:06 2007 @@ -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: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Animation.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Animation.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Animation.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Animation.js Mon Feb 19 09:56:06 2007 @@ -0,0 +1,245 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + +dojo.provide("dojo.animation.Animation"); +dojo.require("dojo.animation.AnimationEvent"); + +dojo.require("dojo.lang.func"); +dojo.require("dojo.math"); +dojo.require("dojo.math.curves"); + +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(/*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; + this.duration = duration; + this.repeatCount = repeatCount || 0; + this.rate = rate || 25; + if(accel) { + // accel: Decimal + // id: j + if(dojo.lang.isFunction(accel.getValue)) { + // accel: dojo.math.curves.CatmullRom + // id: k + this.accel = accel; + } else { + var i = 0.35*accel+0.5; // 0.15 <= i <= 0.85 + this.accel = new dojo.math.curves.CatmullRom([[0], [i], [1]], 0.45); + } + } +} + +dojo.lang.extend(dojo.animation.Animation, { + // public properties + curve: null, + duration: 0, + repeatCount: 0, + accel: null, + + // events + onBegin: null, + onAnimate: null, + onEnd: null, + onPlay: null, + onPause: null, + onStop: null, + handler: null, + + // "private" properties + _animSequence: null, + _startTime: null, + _endTime: null, + _lastFrame: null, + _timer: null, + _percent: 0, + _active: false, + _paused: false, + _startRepeatCount: 0, + + // public methods + play: function(/*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; + this._paused = false; + this._percent = 0; + } else if( this._active && !this._paused ) { + return; + } + + this._startTime = new Date().valueOf(); + if( this._paused ) { + this._startTime -= (this.duration * this._percent / 100); + } + this._endTime = this._startTime + this.duration; + this._lastFrame = this._startTime; + + var e = new dojo.animation.AnimationEvent(this, null, this.curve.getValue(this._percent), + this._startTime, this._startTime, this._endTime, this.duration, this._percent, 0); + + this._active = true; + this._paused = false; + + if( this._percent == 0 ) { + if(!this._startRepeatCount) { + this._startRepeatCount = this.repeatCount; + } + e.type = "begin"; + if(typeof this.handler == "function") { this.handler(e); } + if(typeof this.onBegin == "function") { this.onBegin(e); } + } + + e.type = "play"; + if(typeof this.handler == "function") { this.handler(e); } + if(typeof this.onPlay == "function") { this.onPlay(e); } + + if(this._animSequence) { this._animSequence._setCurrent(this); } + + this._cycle(); + }, + + pause: function() { + // 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; + 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() { + // summary: Toggle between play and paused states. + if( !this._active || this._paused ) { + this.play(); + } else { + this.pause(); + } + }, + + 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; + this._percent = pct; + if( andPlay ) { this.play(); } + }, + + 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); + if(typeof this.handler == "function") { this.handler(e); } + if(typeof this.onStop == "function") { this.onStop(e); } + this._active = false; + this._paused = false; + }, + + 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"; /* String */ + } else { + 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); + var fps = 1000 / (curr - this._lastFrame); + this._lastFrame = curr; + + if( step >= 1 ) { + step = 1; + this._percent = 100; + } else { + this._percent = step * 100; + } + + // Perform accelleration + if(this.accel && this.accel.getValue) { + step = this.accel.getValue(step); + } + + var e = new dojo.animation.AnimationEvent(this, "animate", this.curve.getValue(step), + this._startTime, curr, this._endTime, this.duration, this._percent, Math.round(fps)); + + if(typeof this.handler == "function") { this.handler(e); } + if(typeof this.onAnimate == "function") { this.onAnimate(e); } + + if( step < 1 ) { + this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate); + } else { + e.type = "end"; + this._active = false; + if(typeof this.handler == "function") { this.handler(e); } + if(typeof this.onEnd == "function") { this.onEnd(e); } + + if( this.repeatCount > 0 ) { + this.repeatCount--; + this.play(true); + } else if( this.repeatCount == -1 ) { + this.play(true); + } else { + if(this._startRepeatCount) { + this.repeatCount = this._startRepeatCount; + this._startRepeatCount = 0; + } + if( this._animSequence ) { + this._animSequence._playNext(); + } + } + } + } + } +}); Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Animation.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Animation.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Animation.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationEvent.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationEvent.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationEvent.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationEvent.js Mon Feb 19 09:56:06 2007 @@ -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: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationEvent.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationEvent.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationEvent.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationSequence.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationSequence.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationSequence.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationSequence.js Mon Feb 19 09:56:06 2007 @@ -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: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationSequence.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationSequence.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/AnimationSequence.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Timer.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Timer.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Timer.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Timer.js Mon Feb 19 09:56:06 2007 @@ -0,0 +1,16 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + +dojo.provide("dojo.animation.Timer"); +dojo.require("dojo.lang.timing.Timer"); + +dojo.deprecated("dojo.animation.Timer is now dojo.lang.timing.Timer", "0.5"); + +dojo.animation.Timer = dojo.lang.timing.Timer; Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Timer.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Timer.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/Timer.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/__package__.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/__package__.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/__package__.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/__package__.js Mon Feb 19 09:56:06 2007 @@ -0,0 +1,20 @@ +/* + Copyright (c) 2004-2006, The Dojo Foundation + All Rights Reserved. + + Licensed under the Academic Free License version 2.1 or above OR the + modified BSD license. For more information on Dojo licensing, see: + + http://dojotoolkit.org/community/licensing.shtml +*/ + +dojo.kwCompoundRequire({ + common: [ + "dojo.animation.AnimationEvent", + "dojo.animation.Animation", + "dojo.animation.AnimationSequence" + ] +}); +dojo.provide("dojo.animation.*"); + +dojo.deprecated("dojo.Animation.* is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5"); Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/__package__.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/__package__.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/animation/__package__.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/behavior.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/behavior.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/behavior.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/behavior.js Mon Feb 19 09:56:06 2007 @@ -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: ofbiz/trunk/framework/images/webapp/images/dojo/src/behavior.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/behavior.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/images/webapp/images/dojo/src/behavior.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/images/webapp/images/dojo/src/bootstrap1.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/dojo/src/bootstrap1.js?view=auto&rev=509273 ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/dojo/src/bootstrap1.js (added) +++ ofbiz/trunk/framework/images/webapp/images/dojo/src/bootstrap1.js Mon Feb 19 09:56:06 2007 @@ -0,0 +1,345 @@ +/** +* @file bootstrap1.js +* +* summary: First file that is loaded that 'bootstraps' the entire dojo library suite. +* note: Must run before hostenv_*.js file. +* +* @author Copyright 2004 Mark D. Anderson ([hidden email]) +* 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 6824 2006-12-06 09:34:32Z alex $ +*/ + +// TODOC: HOW TO DOC THE BELOW? +// @global: djConfig +// summary: +// Application code can set the global 'djConfig' prior to loading +// the library to override certain global settings for how dojo works. +// description: The variables that can be set are as follows: +// - isDebug: false +// - allowQueryConfig: false +// - baseScriptUri: "" +// - baseRelativePath: "" +// - libraryScriptUri: "" +// - iePreventClobber: false +// - ieClobberMinimal: true +// - 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; + + +// **************************************************************** +// 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 +} + +// make sure djConfig is defined +if(dj_undef("djConfig", this)){ + var djConfig = {}; +} + +//TODOC: HOW TO DOC THIS? +// dojo is the root variable of (almost all) our public symbols -- make sure it is defined. +if(dj_undef("dojo", this)){ + var dojo = {}; +} + +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; +} + +// Override locale setting, if specified +dojo.locale = djConfig.locale; + +//TODOC: HOW TO DOC THIS? +dojo.version = { + // summary: version number of this instance of dojo. + major: 0, minor: 4, patch: 1, flag: "", + revision: Number("$Rev$".match(/[0-9]+/)[0]), + toString: function(){ + with(dojo.version){ + return major + "." + minor + "." + patch + |
Free forum by Nabble | Edit this page |