/*
 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
require({cache:{"url:esri/dijit/geoenrichment/templates/BufferOptions.html":"<table>\r\n    <tr>\r\n        <td class=\"BufferOptions_StudyAreaLabel\">${nls.studyArea}</td>\r\n        <td>\r\n            <select data-dojo-type=\"dijit/form/Select\"\r\n                data-dojo-attach-point=\"typeSelect\"\r\n                data-dojo-attach-event=\"onChange: _typeChange\"\r\n                class=\"BufferOptions_TypeSelect\">\r\n                <option value=\"Ring\">${nls.ring}</option>\r\n                <option value=\"DriveTime\">${nls.driveTime}</option>\r\n                <option value=\"DriveDistance\">${nls.driveDistance}</option>\r\n            </select>\r\n        </td>\r\n    </tr>\r\n    <tr>\r\n        <td class=\"BufferOptions_RadiusLabel\">${nls.radius}</td>\r\n        <td>\r\n            <input data-dojo-type=\"dijit/form/NumberSpinner\"\r\n                data-dojo-attach-point=\"radiusSpinner\"\r\n                data-dojo-props=\"intermediateChanges:true,constraints:{min:0,max:100}\"\r\n                value=\"1\"\r\n                class=\"BufferOptions_RadiusSpinner\"\r\n                data-dojo-attach-event=\"onChange: _radiusChange\" />\r\n            <select data-dojo-type=\"dijit/form/Select\"\r\n                data-dojo-attach-point=\"unitsSelect\"\r\n                data-dojo-attach-event=\"onChange: _unitsChange\"\r\n                class=\"BufferOptions_UnitsSelect\">\r\n            </select>\r\n            <span data-dojo-attach-point=\"minutesSpan\" style=\"display: none;\">${nls.units.esriDriveTimeUnitsMinutes}</span>\r\n        </td>\r\n    </tr>\r\n</table>\r\n"}});define("esri/dijit/geoenrichment/BufferOptions",["../../declare","dojox/mvc/Templated","dojo/text!./templates/BufferOptions.html","dojo/i18n!../../nls/jsapi","../../tasks/geoenrichment/RingBuffer","../../tasks/geoenrichment/DriveBuffer","../../tasks/geoenrichment/DriveUnits","dijit/form/RadioButton","dijit/form/NumberSpinner","dijit/form/Select"],function(_1,_2,_3,_4,_5,_6,_7){_4=_4.geoenrichment.dijit.BufferOptions;var _8=_1("esri.dijit.geoenrichment.BufferOptions",[_2],{templateString:_3,nls:_4,_buffer:null,_ringBuffer:null,_driveTimeBuffer:null,_driveDistBuffer:null,constructor:function(){this._ringBuffer=new _5();this._driveTimeBuffer=new _6();this._driveDistBuffer=new _6({radius:1,units:_7.MILES});this._buffer=this._ringBuffer;},buildRendering:function(){this.inherited(arguments);this._updateUI();},_getBufferAttr:function(){return this._buffer;},_setBufferAttr:function(_9){if(this._buffer===_9){return;}if(_9 instanceof _5){this._ringBuffer=_9;}else{if(_9 instanceof _6){if(_9.units==_7.MINUTES){this._driveTimeBuffer=_9;}else{this._driveDistBuffer=_9;}}else{throw "Unexpected buffer type";}}this._buffer=_9;this._updateUI();this._onChange();},_updateUI:function(){var _a;if(this._buffer instanceof _5){_a="Ring";}else{if(this._buffer instanceof _6){if(this._buffer.units==_7.MINUTES){_a="DriveTime";}else{_a="DriveDistance";}}}this.typeSelect.set("value",_a);this.radiusSpinner.set("value",this._buffer.radii[0]);this._updateUnits();},_typeChange:function(){switch(this.typeSelect.get("value")){case "Ring":this.set("buffer",this._ringBuffer);break;case "DriveTime":this.set("buffer",this._driveTimeBuffer);break;case "DriveDistance":this.set("buffer",this._driveDistBuffer);break;}},_updateUnits:function(){this.unitsSelect.removeOption(this.unitsSelect.getOptions());var _b=this.typeSelect.get("value");if(_b=="DriveTime"){this.minutesSpan.style.display="";this.unitsSelect.domNode.style.display="none";}else{this.minutesSpan.style.display="none";this.unitsSelect.domNode.style.display="";this._addOption(_7.MILES);this._addOption(_7.KILOMETERS);this._addOption(_7.FEET);this._addOption(_7.METERS);}this.unitsSelect.set("value",this._buffer.units);},_addOption:function(id){this.unitsSelect.addOption({value:id,label:_4.units[id]});},_unitsChange:function(){var _c=this.unitsSelect.get("value");if(_c){this._buffer.units=_c;}this._onChange();},_radiusChange:function(){this._buffer.radii=[this.radiusSpinner.get("value")];this._onChange();},_onChange:function(){this.onChange();},onChange:function(){}});return _8;});