define([
"dojo/_base/declare",
"dojo/_base/connect",
"dojo/_base/lang",
"dojo/_base/event",
"dojo/aspect",
"dojo/dom-attr",
"dojo/dom-class",
"dojo/dom-construct",
"dojo/query"
], function(declare, connect, lang, event, aspect, domAttr, domClass, domConstruct, query) {
var _css = "dojoxRotatorThumb",
_selected = _css + "Selected";
return declare("dojox.widget.rotator.ThumbnailController", null, {
// summary:
// A rotator controller that displays thumbnails of each rotator pane.
// description:
// The ThumbnailController will look at each of the rotator's panes and
// only if the node is an `
` tag, then it will create an thumbnail of
// the pane's image using the `
` tag's "thumbsrc" or "src" attribute.
//
// The size of the thumbnails and the style of the selected thumbnail is
// controlled using CSS.
// example:
// |
// |

// |

// |
// |
// rotator: dojox/widget/Rotator
// An instance of a Rotator widget.
rotator: null,
constructor: function(/*Object*/params, /*DomNode|string*/node){
// summary:
// Initializes the thumbnails and connect to the rotator.
lang.mixin(this, params);
this._domNode = node;
// check if we have a valid rotator
var r = this.rotator;
if(r){
// remove all of the controller's child nodes just in case
while(node.firstChild){
node.removeChild(node.firstChild);
}
for(var i=0; i'
}, node);
})(i);
}
}
aspect.after(r, 'onUpdate', lang.hitch(this, "_onUpdate"), true);
}
},
destroy: function(){
// summary:
// Disconnect from the rotator.
domConstruct.destroy(this._domNode);
},
_onUpdate: function(/*string*/type){
// summary:
// Updates various pager controls when the rotator updates.
var r = this.rotator; // no need to test if this is null since _onUpdate is only fired by the rotator
if(type == "onAfterTransition"){
var n = query('.' + _css, this._domNode).removeClass(_selected);
if(r.idx < n.length){
domClass.add(n[r.idx], _selected);
}
}
}
});
});