diff options
| author | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
|---|---|---|
| committer | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
| commit | b62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch) | |
| tree | 86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /js/dojo-1.6/dojox/widget/Loader.xd.js | |
Diffstat (limited to 'js/dojo-1.6/dojox/widget/Loader.xd.js')
| -rw-r--r-- | js/dojo-1.6/dojox/widget/Loader.xd.js | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/widget/Loader.xd.js b/js/dojo-1.6/dojox/widget/Loader.xd.js new file mode 100644 index 0000000..2923de1 --- /dev/null +++ b/js/dojo-1.6/dojox/widget/Loader.xd.js @@ -0,0 +1,123 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.widget.Loader"],
+["require", "dijit._Widget"],
+["require", "dijit._Templated"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.widget.Loader"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.widget.Loader"] = true;
+dojo.provide("dojox.widget.Loader");
+dojo.deprecated("dojox.widget.Loader", "", "2.0");
+
+dojo.require("dijit._Widget");
+dojo.require("dijit._Templated");
+
+dojo.declare("dojox.widget.Loader", [dijit._Widget,dijit._Templated], {
+ // summary: a configurable global xhr-listener to display
+ // a loading message during running xhr's or to simply provide
+ // base-level topic to subscribe to for custom loading messages
+ //
+ // loadIcon: String
+ // location to the icon used.
+ loadIcon: dojo.moduleUrl("dojox.widget.Loader","icons/loading.gif"),
+
+ // loadMessage: String
+ // string to use for progress loading
+ loadMessage: 'Loading ...',
+
+ // hasVisuals: Boolean
+ // true to display a fixed loading message in TR cornder, false to unly provide
+ // "Loader" topic to subscribe to for your own custom loading message.
+ hasVisuals: true,
+
+ // attachToPointer
+ // true to use visual indicator where cursor is
+ attachToPointer: true,
+
+ // duration: Integer
+ // time in ms to toggle in/out the visual load indicator
+ duration: 125,
+
+ // _offset: Integer
+ // distance in px from the mouse pointer to show attachToPointer avatar
+ _offset: 16,
+
+ // holder for mousemove connection
+ _pointerConnect: null,
+ _xhrStart: null,
+ _xhrEnd: null,
+
+ templateString: '<div dojoAttachPoint="loadNode" class="dojoxLoader">'
+ +'<img src="${loadIcon}" class="dojoxLoaderIcon"> <span dojoAttachPoint="loadMessageNode" class="dojoxLoaderMessage"></span>'
+ +'</div>',
+
+ postCreate: function(){
+ // summary: setup the loader
+
+ if(!this.hasVisuals){
+ this.loadNode.style.display = "none"; // _destroy()?
+ }else{
+ if(this.attachToPointer){
+ dojo.removeClass(this.loadNode,"dojoxLoader");
+ dojo.addClass(this.loadNode,"dojoxLoaderPointer");
+ }
+ this._hide();
+ }
+ this._setMessage(this.loadMessage);
+
+ // FIXME: create our connections. would be easier, and this might be redundant
+ // if Deferred published something. XHR published stuff. FIXME to use that.
+ this._xhrStart = this.connect(dojo,"_ioSetArgs","_show");
+ this._xhrEnd = this.connect(dojo.Deferred.prototype,"_fire","_hide");
+
+ },
+
+ _setMessage: function(/* String */ message){
+ // summary: set's the message in the loader
+ this.loadMessageNode.innerHTML = message;
+ },
+
+ _putLoader: function(/* Event */ e){
+ // summary: place the floating loading element based on mousemove connection position
+ dijit.placeOnScreen(this.loadNode,{ x: e.clientX+this._offset, y:e.clientY+this._offset }, ["TL","BR"]);
+ },
+
+ _show: function(){
+ // summary: publish and show progress indicator
+ dojo.publish("Loader",[{ message: 'started' }]);
+ if(this.hasVisuals){
+ if(this.attachToPointer){
+ this._pointerConnect = this.connect(document,"onmousemove","_putLoader");
+ }
+ dojo.style(this.loadNode, {
+ opacity:0, display:""
+ });
+ dojo.fadeIn({ node: this.loadNode, duration:this.duration }).play();
+ }
+ },
+
+ _hide: function(){
+ // summary: publish "xhr ended" and hide progress indicator
+ dojo.publish("Loader",[{ message: 'ended' }]);
+ if(this.hasVisuals){
+ if(this.attachToPointer){
+ this.disconnect(this._pointerConnect);
+ }
+ dojo.fadeOut({
+ node: this.loadNode,
+ duration:this.duration,
+ onEnd: dojo.partial(dojo.style, this.loadNode, "display", "none")
+ }).play();
+ }
+ }
+
+});
+
+}
+
+}};});
|
