/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */
//>>built
define("esri/dijit/geoenrichment/Infographic",["require","../../declare","dojo/_base/lang","dojo/dom-construct","esri/dijit/_EventedWidget","./Geoenrichment","./config","dojo/on","../../tasks/geoenrichment/GeometryStudyArea","../../tasks/geoenrichment/RingBuffer","./_Interop","../../tasks/geoenrichment/studyAreaFromJson","../../tasks/geoenrichment/studyAreaOptionsFromJson","dojo/dom-class","./_Invoke","./utils"],function(_1,_2,_3,_4,_5,_6,_7,on,_8,_9,_a,_b,_c,_d,_e,_f){var _10=_2("esri.dijit.geoenrichment.Infographic",[_5,_e],{countryID:null,datasetID:null,levels:_7.levels,highestLevel:_7.highestLevel,title:null,type:null,variables:null,studyArea:null,studyAreaOptions:null,autoWidth:true,autoHeight:true,expanded:true,returnGeometry:false,_ge:null,_eventMap:{"resize":["size"],"data-request":true,"data-ready":["provider"],"data-load":true,"data-error":["error"]},constructor:function(){this.studyAreaOptions=new _9();},postMixInProperties:function(){this._ge=new _6();this._ge.on("start",_3.hitch(this,this._onDataRequest));this._ge.on("data",_3.hitch(this,this._onDataReady));this._ge.on("end",_3.hitch(this,this._onDataLoad));this._ge.on("error",_3.hitch(this,this._onDataError));if(this.type){this._updateReport();}},buildRendering:function(){this.inherited(arguments);this.domNode=_4.create("div");if(!this.expanded){_d.add(this.domNode,"Collapsed");}},destroy:function(){this._destroyReportWidget();this._ge.stop();this.inherited(arguments);},_setReturnGeometryAttr:function(_11){this._set("returnGeometry",_11);this._ge.returnGeometry=_11;},_setTitleAttr:function(_12){this._set("title",_12);this._ge.title=_12;},_setTypeAttr:function(_13){if(this.type==_13){return;}this._set("type",_13);if(this._widget){this._widget.setDataProvider(null);}this._updateReport();},_updateReport:function(){this._updateLevels();this.invoke("_requireReport");},_requireReport:function(){if(!this.type){return;}_1([_1.toAbsMid("./"+this.type)],_3.hitch(this,this._createReportWidget,this.type));},_setCountryIDAttr:function(_14){this._set("countryID",_14);this._ge.country=_14;},_setDatasetIDAttr:function(_15){this._set("datasetID",_15);this._ge.dataset=_15;},_setVariablesAttr:function(_16){this._set("variables",_16);this._ge.setVariables(_16);},_setStudyAreaAttr:function(_17){if(!(_17 instanceof _8)){throw new Error("Not implemented yet");}this._set("studyArea",_17);this._ge.setInGeom(_17.geometry);},_setStudyAreaOptionsAttr:function(_18){this._set("studyAreaOptions",_18);this._ge.setBuffer(_18);},_setExpandedAttr:function(_19){if(this.expanded==_19){return;}this._destroyReportWidget();this._set("expanded",_19);if(_19){_d.remove(this.domNode,"Collapsed");}else{_d.add(this.domNode,"Collapsed");}this._updateReport();},_setCacheLimitAttr:function(_1a){this._ge.setCacheLimit(_1a);},_updateLevels:function(){var _1b=_f.supportsComparison(this.type,this.expanded);if(_1b){this._ge.setGeoLevels(this.levels,this.highestLevel);}else{this._ge.setGeoLevels(null,null);}},_widget:null,_createReportWidget:function(_1c,_1d){if(this._destroyed||this.type!=_1c){return;}if(this._ge.isBusy()){on.once(this._ge,"end",_3.hitch(this,this._createReportWidget,this.type,_1d));return;}var _1e=this._widget?this._widget.getState("selectedComparison"):NaN;this._destroyReportWidget();if(!this.type){return;}this._widget=new _1d(this.domNode);this._widget.autoWidth=this.autoWidth;this._widget.autoHeight=this.autoHeight;this._widget.expanded=this.expanded;this._widget.on("resize",_3.hitch(this,this._onResize));if(!isNaN(_1e)){this._widget.setState({"selectedComparison":_1e});}this._widget.setDataProvider(this._ge);},_destroyReportWidget:function(){if(this._widget){this._widget.destroy();this._widget=null;}},_onResize:function(_1f){this.onResize(_1f);},onResize:function(_20){},_onDataRequest:function(){this.onDataRequest();},onDataRequest:function(){},_onDataReady:function(){this.onDataReady(this._ge);},onDataReady:function(_21){},_onDataLoad:function(){this.onDataLoad();},onDataLoad:function(){},_onDataError:function(_22){this.onDataError(_22);},onDataError:function(_23){}});_10.Interop=_2([_10,_a],{converters:{"variables":_a.arrayConverter,"studyArea":new _a.JsonConverter(_b),"studyAreaOptions":new _a.JsonConverter(_c),"expanded":_a.BoolConverter}});return _10;});