root / trunk / web / dojo / dojox / image / Gallery.js @ 12
History | View | Annotate | Download (2.96 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.image.Gallery"]){ |
||
9 | dojo._hasResource["dojox.image.Gallery"]=true; |
||
10 | dojo.provide("dojox.image.Gallery");
|
||
11 | dojo.experimental("dojox.image.Gallery");
|
||
12 | dojo.require("dojo.fx");
|
||
13 | dojo.require("dijit._Widget");
|
||
14 | dojo.require("dijit._Templated");
|
||
15 | dojo.require("dojox.image.ThumbnailPicker");
|
||
16 | dojo.require("dojox.image.SlideShow");
|
||
17 | dojo.declare("dojox.image.Gallery",[dijit._Widget,dijit._Templated],{imageHeight:375,imageWidth:500,pageSize:dojox.image.SlideShow.prototype.pageSize,autoLoad:true,linkAttr:"link",imageThumbAttr:"imageUrlThumb",imageLargeAttr:"imageUrl",titleAttr:"title",slideshowInterval:3,templateString:dojo.cache("dojox.image","resources/Gallery.html","<div dojoAttachPoint=\"outerNode\" class=\"imageGalleryWrapper\">\n\t<div dojoAttachPoint=\"thumbPickerNode\"></div>\n\t<div dojoAttachPoint=\"slideShowNode\"></div>\n</div>\n"),postCreate:function(){ |
||
18 | this.widgetid=this.id; |
||
19 | this.inherited(arguments); |
||
20 | this.thumbPicker=new dojox.image.ThumbnailPicker({linkAttr:this.linkAttr,imageLargeAttr:this.imageLargeAttr,imageThumbAttr:this.imageThumbAttr,titleAttr:this.titleAttr,useLoadNotifier:true,size:this.imageWidth},this.thumbPickerNode); |
||
21 | this.slideShow=new dojox.image.SlideShow({imageHeight:this.imageHeight,imageWidth:this.imageWidth,autoLoad:this.autoLoad,linkAttr:this.linkAttr,imageLargeAttr:this.imageLargeAttr,titleAttr:this.titleAttr,slideshowInterval:this.slideshowInterval,pageSize:this.pageSize},this.slideShowNode); |
||
22 | var _1=this; |
||
23 | dojo.subscribe(this.slideShow.getShowTopicName(),function(_2){ |
||
24 | _1.thumbPicker._showThumbs(_2.index); |
||
25 | }); |
||
26 | dojo.subscribe(this.thumbPicker.getClickTopicName(),function(_3){ |
||
27 | _1.slideShow.showImage(_3.index); |
||
28 | }); |
||
29 | dojo.subscribe(this.thumbPicker.getShowTopicName(),function(_4){ |
||
30 | _1.slideShow.moveImageLoadingPointer(_4.index); |
||
31 | }); |
||
32 | dojo.subscribe(this.slideShow.getLoadTopicName(),function(_5){ |
||
33 | _1.thumbPicker.markImageLoaded(_5); |
||
34 | }); |
||
35 | this._centerChildren();
|
||
36 | },setDataStore:function(_6,_7,_8){ |
||
37 | this.thumbPicker.setDataStore(_6,_7,_8);
|
||
38 | this.slideShow.setDataStore(_6,_7,_8);
|
||
39 | },reset:function(){ |
||
40 | this.slideShow.reset();
|
||
41 | this.thumbPicker.reset();
|
||
42 | },showNextImage:function(_9){ |
||
43 | this.slideShow.showNextImage();
|
||
44 | },toggleSlideshow:function(){ |
||
45 | dojo.deprecated("dojox.widget.Gallery.toggleSlideshow is deprecated. Use toggleSlideShow instead.","","2.0"); |
||
46 | this.toggleSlideShow();
|
||
47 | },toggleSlideShow:function(){ |
||
48 | this.slideShow.toggleSlideShow();
|
||
49 | },showImage:function(_a,_b){ |
||
50 | this.slideShow.showImage(_a,_b);
|
||
51 | },resize:function(_c){ |
||
52 | this.thumbPicker.resize(_c);
|
||
53 | },_centerChildren:function(){ |
||
54 | var _d=dojo.marginBox(this.thumbPicker.outerNode); |
||
55 | var _e=dojo.marginBox(this.slideShow.outerNode); |
||
56 | var _f=(_d.w-_e.w)/2; |
||
57 | if(_f>0){ |
||
58 | dojo.style(this.slideShow.outerNode,"marginLeft",_f+"px"); |
||
59 | }else{
|
||
60 | if(_f<0){ |
||
61 | dojo.style(this.thumbPicker.outerNode,"marginLeft",(_f*-1)+"px"); |
||
62 | } |
||
63 | } |
||
64 | }}); |
||
65 | } |