
namespace("SLAMM");$namespace.Plugin=Class.create(userSmarts.runtime.Activator);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);SLAMM.Plugin.instance=this;};$namespace.Plugin.getDefault=function(){return SLAMM.Plugin.instance;};$prototype.start=function(){var thMgr=userSmarts.ui.WorkbenchPlugin.getDefault().getThemeManager();thMgr.setCurrentTheme("slamm.theme.default");};$prototype.stop=function(){};$prototype.getController=function(){return this.controller;};$namespace.Plugin.find=function(path){return SLAMM.Plugin.getDefault().getURI(path);};namespace("SLAMM");$namespace.MapController=Class.create(Bean);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{maps:[],layers:[]});superClass.call(this,properties);this.listeners=[];var ps=userSmarts.runtime.Platform.getPropertyService();this.listeners.push(ps.connect("comparison","selected",this,this.onComparisonSelected));};$prototype.register=function(map){var index=(map.id*1)-1;this.maps[index]=map;var ctx=map.getProperty("context");this.listeners.push(connect(ctx,userSmarts.maps.context.ViewContext.VIEW_CHANGE_EVENT_PROPERTY,this,'onContextViewChange'));if(index==0){this.listeners.push(connect(ctx,userSmarts.maps.context.ViewContext.LAYER_CHANGED_EVENT_PROPERTY,this,'onContextLayerChange'));this.listeners.push(connect(ctx,userSmarts.maps.context.ViewContext.CHANGE_EVENT_PROPERTY,this,'onContextChange'));}};$prototype.dispose=function(){for(var i=0;i<this.listeners.length;++i){disconnect(this.listeners[i]);this.listeners[i]=null;}
this.maps=[];this.layers=[];this.baseMap=null;};$prototype.getViewContextModel=function(){if(this.vcmodel==null){if(this.maps[0]!=null){this.vcmodel=new userSmarts.maps.models.ViewContextTableModel({context:this.maps[0].context});}}
return this.vcmodel;};$prototype.onComparisonSelected=function(event){if(this.maps.length>0){this.loadComparisonLayers(event.newValue);}};$prototype.loadComparisonLayers=function(input){this.lock();var layer=null;for(var i=0;i<this.layers.length;++i){layer=this.layers[i];if(layer!=null){this.maps[i].context.removeLayer(layer);}}
this.unlock();if(input!=null){var entry;if(isXmlNode(input)){entry=new userSmarts.pub.atom.Entry({node:input});}else if(input instanceof userSmarts.pub.atom.Entry){entry=input;}
if(input==null){alert("Invalid comparison object");return;}
var url1=entry.getLink("layer1");var url2=entry.getLink("layer2");if(url1!=""&&url2!=""){this.loadLayer(url1,0);this.loadLayer(url2,1);}}else{this.updateViewWithText(0,"Map 1");this.updateViewWithText(1,"Map 2");}};$prototype.loadLayer=function(url,index){var res=new userSmarts.pub.Resource({url:url,params:{format:"text/xml"}});var def=res.get();def.addCallback(bind(this.parseLayer,this,index));def.addErrback(handleResponseError);};$prototype.parseLayer=function(index,data){var entry=new userSmarts.maps.pub.LayerEntry({node:data.documentElement});var layer=entry.getLayer();var map=this.maps[index];if(layer!=null&&map!=null){var context=map.context;this.lock();context.addLayer(layer,0);this.layers[index]=layer;this.updateViewWithText(index,layer.lid);this.unlock();}};$prototype.updateViewWithText=function(index,text){var wb=userSmarts.ui.PlatformUI.getWorkbench();var page=wb.getActiveWorkbenchWindow().getActivePage();var ref=page.findViewReference("SLAMM.views.MapView"+(index+1));var persp=page.currentPerspective;var perspLayout=persp.layout;var viewLayout=perspLayout.layouts["r1c"+(index+1)];var tab=viewLayout.tabMap[ref];if(tab){tab.setText(text);}};$prototype.onContextViewChange=function(event){if(!this.isLocked()){var index=0;if(event.source==this.maps[0].context){index=1;}
this.lock();this.maps[index].context.setView(event.newValue);this.unlock();}};$prototype.onContextLayerChange=function(event){var evt=event.newValue;var source=evt.source;var context=this.maps[1].context;var layers=context.layers;for(var lc=0;lc<layers.length;++lc){if(source.getLayerName()==layers[lc].getLayerName()){layers[lc][evt.propertyName]=evt.newValue;break;}}
context.touch();};$prototype.onContextChange=function(event){var layers1=this.maps[0].context.layers;var layers2=this.maps[1].context.layers;var needsRefresh=false;var layer1;var layer2;for(var l1c=0;l1c<layers1.length;++l1c){layer1=layers1[l1c];layer2=layers2[l1c];if(!layer1||!layer2)break;if(layer1.getLayerName()!=layer2.getLayerName()){needsRefresh=true;for(var l2c=l1c;l2c<layers2.length;++l2c){layer2=layers2[l2c];if(layer1.getLayerName()==layer2.getLayerName()){this.maps[1].context.shiftTo(layer2,l1c,false);break;}}}}
if(needsRefresh){this.maps[1].context.touch();}};$prototype.lock=function(){this.locked=true;};$prototype.unlock=function(){this.locked=false;};$prototype.isLocked=function(){return this.locked==true;};$prototype.setExtent=function(extent){if(extent instanceof Geometry){this.maps[0].context.setView(extent);}};namespace("SLAMM");$namespace.DefaultTheme=Class.create(userSmarts.theme.userSmartsTheme);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);this.name="Default SLAMM Theme";var path=SLAMM.Plugin.find("images/a.png");var prefix=path.substring(0,path.indexOf("images/a.png"));prefix+="images/";var path=SLAMM.Plugin.find("images/slamm.theme.default.sprite.png");var prefix=path.substring(0,path.indexOf("images/slamm.theme.default.sprite.png"));this.setSpriteImage("image.a",prefix+"images/slamm.theme.default.sprite.png",-1,-1);this.setSpriteImage("image.aoi.reset",prefix+"images/slamm.theme.default.sprite.png",-1,-19);this.set("image.logo.small",prefix+"images/logo.small.png");};namespace("SLAMM.models");$namespace.ComparisonsListModel=Class.create(userSmarts.pub.GeoOpenSearchTableModel);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{columns:[],request:null,pageSize:10,currentRow:0,maximumRows:10,buffer:[],keywords:[""],useAndOperator:true,nodeOffset:0,depth:0,nodeNames:["entry"]});superClass.call(this,properties);this.addColumn(new userSmarts.wt.widgets.DOMTableColumn({label:"Title",name:"title",index:0,order:true}));this.addColumn(new userSmarts.wt.widgets.DOMTableColumn({label:"Description",name:"summary",index:1,order:true}));this.addColumn(new userSmarts.wt.widgets.DOMTableColumn({label:"Category",name:"category",index:2,order:true}));this.setSortElement(this.columns[0].name);this.setSortOrder(this.columns[0].order);this.setProperty("source","comparisons.xml");};$prototype.getRows=function(){var results=userSmarts.pub.GeoOpenSearchTableModel.prototype.getRows.call(this);if(results){return results.subset(this.getOffset(),this.getOffset()+this.getPageSize());}
return[];};namespace("SLAMM.models");$namespace.RegionModel=Class.create(userSmarts.wt.widgets.TreeModel);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);this.resource=new userSmarts.pub.Resource({params:{format:"text/json"}});if(this.source){this.resource.setURL(this.source);}
this.loadedCallback=bind(this.onLoaded,this);this.errCallback=bind(this.onError,this);};$prototype.setSource=function(source){this.resource.setURL(source);};$prototype.getRoot=function(){return this.root;};$prototype.getLabel=function(element){if(element==this.root){return"Regions";}else{return element.name||element.title;}};$prototype.hasChildren=function(element){if(element==this.root){return element.regions.length>0;}else{return(element.items&&typeof(element.items.push)!="undefined"&&element.items.length>0);}
return false;};$prototype.getChildren=function(element){if(element==this.root){return element.regions;}else{return element.items;}};$prototype.getParent=function(element){if(element==this.root)return null;if(element.items&&typeof(element.items.push)!="undefined"){return this.root;}else{for(var i=0;i<this.root.regions.length;++i){for(var j=0;j<this.root.regions[i].items.length;++j){if(this.root.regions[i].items[j].title==element.title){return this.root.regions[i];}}}}
return null;};$prototype.getClassName=function(element,expanded){return this.getIconClassName(element,expanded);};$prototype.getIconClassName=function(element,expanded){if(this.hasChildren(element)){return"image.tree.folder."+(expanded?"open":"closed");}
return"image.tree.file";};$prototype.getLabelClassName=function(element,expanded){return'tree-node-label';};$prototype.compareNodes=function(element1,element2){if(element1.name&&element2.name&&element1.name==element2.name)return true;if(element1.title&&element2.title&&element1.title==element2.title)return true;return false;};$prototype.populate=function(){var deferred=this.resource.get();deferred.addCallback(this.loadedCallback);deferred.addErrback(this.errCallback);};$prototype.onLoaded=function(json){this.root=json;this.setProperty("modified",true);this.setProperty("modelChanged",true);};$prototype.onError=function(e){handleResponseError(e);this.root={regions:[]};this.setProperty("modified",true);this.setProperty("modelChanged",true);};namespace("SLAMM.views");$namespace.ComparisonsListView=Class.create(userSmarts.ui.views.ListView);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);this.model=new SLAMM.models.ComparisonsListModel({pageSize:50});this.selected=null;};$prototype.setSelection=function(obj){this.setProperty("selected",obj);var ps=userSmarts.runtime.Platform.getPropertyService();ps.setProperty("comparison","selected",obj);};$prototype.onSelectionChange=function(event){if(event.newValue){var wrapper=event.newValue;var node=wrapper.getNode();if(node!=this.selected){this.setSelection(node);}}else{this.setSelection(null);}};namespace("SLAMM.views");$namespace.ComparisonsTableView=Class.create(userSmarts.ui.views.TableView);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);this.model=new SLAMM.models.ComparisonsListModel({pageSize:50});this.selected=null;};$prototype.setSelection=function(obj){this.setProperty("selected",obj);var ps=userSmarts.runtime.Platform.getPropertyService();ps.setProperty("comparison","selected",obj);};$prototype.onTableSelectionChange=function(event){if(event.newValue){var wrapper=event.newValue;var node=wrapper.getNode();if(node!=this.selected){this.setSelection(node);}}else{this.setSelection(null);}};namespace("SLAMM.views");$namespace.MapView=Class.create(userSmarts.maps.views.MapView);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{mapId:properties.id.substring(properties.id.length-1,properties.id.length)});superClass.call(this,properties);};$prototype.addTools=function(toolbarModel,toolFactory){toolbarModel.addTool(new userSmarts.maps.tools.HelpTool({factory:toolFactory,model:toolbarModel}));toolbarModel.addTool(new userSmarts.maps.tools.PanTool({factory:toolFactory}));toolbarModel.addTool(new userSmarts.maps.tools.DragTool({factory:toolFactory}));toolbarModel.addTool(new userSmarts.maps.tools.ZoomTool({factory:toolFactory}));toolbarModel.addTool(new userSmarts.maps.tools.ZoomToBoxTool({factory:toolFactory}));toolbarModel.addTool(new SLAMM.actions.ResetAOITool({factory:toolFactory}));};$prototype.createPartControl=function(){if(!this.layout){var layout=DIV({'class':'map-view'});layout.style.overflow="hidden";this.layout=layout;var map=this.buildMap();this.map=map;this.contributeToActionBars();this.loadBaseMapContext();}
this.control=new userSmarts.maps.widget.MapControl({adapter:this,node:this.layout});return this.control;};$prototype.loadBaseMapContext=function(){if(this.baseMap==null){var res=new userSmarts.pub.Resource({url:"base.xml",params:{format:"text/xml"}});var d=res.get();d.addCallback(bind(this.parseMap,this));d.addErrback(handleResponseError);}};$prototype.parseMap=function(data){var parser=new userSmarts.maps.context.ViewContextParser();var context=parser.fromXML(data);this.map.setContext(context);var controller=SLAMM.Plugin.getDefault().getController();controller.register(this.map);};namespace("SLAMM.views");$namespace.LayerLegend=Class.create(userSmarts.ui.ViewPart);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$prototype.init=function(site){userSmarts.ui.ViewPart.prototype.init.call(this,site);this.contributeToActionBars();};$prototype.createPartControl=function(){if(!this.layout){this.layout=IMG({src:'legend.png'});this.layout.style.width="283px";this.layout.style.height="474px";}
return this.layout;};$prototype.contributeToActionBars=function(){var bars=this.getSite().getActionBars();var tbmgr=bars.getToolbarManager();var action=new userSmarts.wt.action.Action({text:"Popup",toolTipText:"Open Legend in a Pop-up",image:"image.window.new",run:function(){top.consoleRef=window.open('legend.png','legend','width=300,height=500,menubar=0,toolbar=0'+',status=0,scrollbars=0,resizable=0');}});tbmgr.add(action);};namespace("SLAMM.views");$namespace.RegionView=Class.create(userSmarts.ui.ViewPart);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$prototype.init=function(site){userSmarts.ui.ViewPart.prototype.init.call(this,site);site.setPropertyProvider(this);this.contributeToActionBars();};$prototype.createPartControl=function(){this.control=new userSmarts.wt.widgets.Tree();connect(this.control,"selected",this,this.onSelectionChange);setTimeout(bind(this.buildTree,this),1000);return this.control;};$prototype.contributeToActionBars=function(){var bars=this.getSite().getActionBars();var tbmgr=bars.getToolbarManager();tbmgr.add(new SLAMM.actions.ZoomAction());};$prototype.buildTree=function(){this.model=new SLAMM.models.RegionModel();this.model.setSource("regions.json");this.model.populate();this.control.setModel(this.model);};$prototype.onSelectionChange=function(event){var ps=userSmarts.runtime.Platform.getPropertyService();var selected=ps.getProperty("slamm.region","selected");var value=event.newValue;if(value&&!this.model.hasChildren(value)){if(selected!=value){ps.setProperty("slamm.region","selected",new GeoRSS().parseObject(value));}}else{if(selected){ps.setProperty("slamm.region","selected",null);}}};namespace("SLAMM.perspectives");$namespace.ComparisonPerspective=function(){};$namespace.ComparisonPerspective.prototype.createInitialLayout=function(layout){layout.createBox("outer",userSmarts.ui.PageLayout.ID_ROOT_BOX,{orientation:userSmarts.ui.BoxLayout.VERTICAL,width:'100%',height:'100%'});layout.createBox("top","outer",{orientation:userSmarts.ui.BoxLayout.HORIZONTAL,width:'100%',height:'70%'});layout.createBox("bottom","outer",{orientation:userSmarts.ui.BoxLayout.HORIZONTAL,width:'100%',height:'*'});var r1c1=layout.createFolder("r1c1","top",{width:"50%",height:"100%"});var r1c2=layout.createFolder("r1c2","top",{width:"50%",height:"100%"});var r2c1=layout.createFolder("r2c1","bottom",{width:'75%',height:'100%'});var r2c2=layout.createFolder("r2c2","bottom",{width:'*',height:'100%'});r1c1.addView("SLAMM.views.MapView1");r1c2.addView("SLAMM.views.MapView2");r2c1.addView("SLAMM.views.ComparisonsTableView");r2c1.addView("userSmarts.maps.views.ViewContextViewLite");r2c2.addView("SLAMM.views.RegionView");r2c2.addView("SLAMM.views.LayerLegend");r2c2.addView("userSmarts.maps.views.LayerPropertiesView");};namespace("SLAMM.perspectives");$namespace.AnalysisPerspective=function(){};$namespace.AnalysisPerspective.prototype.createInitialLayout=function(layout){layout.createBox("left",userSmarts.ui.PageLayout.ID_ROOT_BOX,{orientation:userSmarts.ui.BoxLayout.VERTICAL,width:'*',height:'100%'});layout.createBox("right",userSmarts.ui.PageLayout.ID_ROOT_BOX,{orientation:userSmarts.ui.BoxLayout.VERTICAL,width:'400',height:'100%'});var editorArea=layout.createFolder(userSmarts.ui.PageLayout.ID_EDITOR_AREA,"left",{width:'100%',height:'*'});var c2r1=layout.createFolder("c1r1","right",{width:'100%',height:'*'});c2r1.addView("userSmarts.maps.views.ViewContextView");c2r1.addView("userSmarts.maps.views.LegendView");};namespace("SLAMM.perspectives");$namespace.MapPerspective=function(){};$namespace.MapPerspective.prototype.createInitialLayout=function(layout){layout.createBox("left",userSmarts.ui.PageLayout.ID_ROOT_BOX,{orientation:userSmarts.ui.BoxLayout.VERTICAL,width:'*',height:'100%'});layout.createBox("right",userSmarts.ui.PageLayout.ID_ROOT_BOX,{orientation:userSmarts.ui.BoxLayout.VERTICAL,width:'400',height:'100%'});var editorArea=layout.createFolder(userSmarts.ui.PageLayout.ID_EDITOR_AREA,"left",{width:'100%',height:'*'});var c2r1=layout.createFolder("c1r1","right",{width:'100%',height:'*'});c2r1.addView("userSmarts.maps.views.ViewContextView");c2r1.addView("userSmarts.maps.views.LegendView");};namespace("SLAMM.app");$namespace.Application=function(){};$namespace.Application.prototype.run=function(args){var controller=new SLAMM.MapController();SLAMM.Plugin.getDefault().controller=controller;userSmarts.maps.DEBUG_FLAG=true;var advisor=new SLAMM.app.WorkbenchAdvisor();var display=userSmarts.ui.PlatformUI.createDisplay();userSmarts.ui.PlatformUI.createAndRunWorkbench(display,advisor);var ps=userSmarts.runtime.Platform.getPropertyService();ps.setProperty("page","activeEditor",SLAMM.Plugin.getDefault().getController());};$namespace.Application.prototype.shutdown=function(){SLAMM.Plugin.getDefault().getController().dispose();userSmarts.ui.PlatformUI.workbench.close();};$namespace.Application.prototype.getMap=function(index){var view=this.getView("SLAMM.views.MapView"+index);if(view!=null){return view.map;}
return null;};$namespace.Application.prototype.getView=function(id){var wb=userSmarts.ui.PlatformUI.getWorkbench();var page=wb.getActiveWorkbenchWindow().getActivePage();var view=page.findView(id,false);return view;};namespace("SLAMM.app");$namespace.ActionBarAdvisor=function(configurer){userSmarts.ui.application.ActionBarAdvisor.call(this,configurer);};$namespace.ActionBarAdvisor.inheritsFrom(userSmarts.ui.application.ActionBarAdvisor);$namespace.ActionBarAdvisor.prototype.fillCoolBar=function(coolBar){coolBar.addItem(new SLAMM.app.SessionBar({id:"SessionBar",'class':'session-bar'}));var psFilter=new SLAMM.app.PerspectiveFilter();var pbar=new userSmarts.ui.PerspectiveBar({perspectiveFilter:psFilter});psFilter.addChangeListener(bind(function(){this.update();},pbar),"updated");coolBar.addItem(pbar);};namespace("SLAMM.app");$namespace.WorkbenchAdvisor=function(){userSmarts.ui.application.WorkbenchAdvisor.call(this);};$namespace.WorkbenchAdvisor.inheritsFrom(userSmarts.ui.application.WorkbenchAdvisor);$namespace.WorkbenchAdvisor.prototype.createWorkbenchWindowAdvisor=function(windowConfigurer){return new SLAMM.app.WorkbenchWindowAdvisor(windowConfigurer);};$namespace.WorkbenchAdvisor.prototype.getInitialWindowPerspectiveId=function(){return"SLAMM.perspectives.ComparisonPerspective";};namespace("SLAMM.app");$namespace.WorkbenchWindowAdvisor=function(windowConfigurer){userSmarts.ui.application.WorkbenchWindowAdvisor.call(this,windowConfigurer);};$namespace.WorkbenchWindowAdvisor.inheritsFrom(userSmarts.ui.application.WorkbenchWindowAdvisor);$prototype.createActionBarAdvisor=function(actionBarConfigurer){return new SLAMM.app.ActionBarAdvisor(actionBarConfigurer);};$prototype.postWindowOpen=function(){};$prototype.createWindowContents=function(shell){var window=this.getWindowConfigurer().getWindow();shell.setLayout(new userSmarts.wt.layout.VerticalRowLayout());var display=shell.getDisplay();shell.setBounds(0,0,display.getWidth(),display.getHeight());var header=new userSmarts.wt.widgets.Composite({id:"page-header",parent:shell,layoutData:{height:35,width:"*"}});header.setLayout(new userSmarts.wt.layout.HorizontalRowLayout());var psFilter=new SLAMM.app.PerspectiveFilter();var pb=new SLAMM.app.PerspectiveBar({parent:header,layoutData:{width:"*",height:"100%"},perspectiveFilter:psFilter});var sb=new SLAMM.app.SessionBar({parent:header,layoutData:{width:"500px",height:"100%"}});connect(psFilter,'updated',pb,'update');this.getWindowConfigurer().createPageComposite(shell);window.getPageComposite().setLayoutData({width:"100%",height:"*"});var fb=new userSmarts.wt.widgets.Control({id:"page-footer",parent:shell,layoutData:{height:"20px"},node:DIV({id:'page-footer'},"Powered by userSmarts(R) GX")});shell.layout();};namespace("SLAMM.app");$namespace.PerspectiveFilter=function(properties){Bean.call(this,properties);};$namespace.PerspectiveFilter.inheritsFrom(Bean);$prototype.filter=function(item){var result=item.id.startsWith("SLAMM.perspectives.");return result;};namespace("SLAMM.app");$namespace.PerspectiveBar=Class.create(userSmarts.ui.PerspectiveBar);$prototype.initialize=function(superClass,properties){superClass.call(this,properties);};$prototype.dispose=function(){var ps=userSmarts.runtime.Platform.getPropertyService();ps.disconnect(this.userListener);this.userListener=null;userSmarts.ui.PerspectiveBar.prototype.dispose.call(this);};namespace("SLAMM.app");$namespace.SessionBar=Class.create(userSmarts.wt.widgets.Control);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{'class':'session-bar',padding:{top:5,left:1,right:10,bottom:1}});superClass.call(this,properties);};$prototype.initNode=function(){var theme=userSmarts.runtime.Platform.getTheme();var logo=theme.getImage("image.logo.small");if(logo){this.node.appendChild(logo);}else{var title=SPAN({},B({},"SLAMM View"));this.node.appendChild(title);}
this.node.appendChild(document.createTextNode(" | "));var icon=theme.getImage("image.help");if(icon){icon.border="0";icon.style.width="16px";icon.style.height="16px";}
if(!icon)icon="";var link=SPAN({},icon," Help");link.onclick=bind(this.displayHelp,this);link.style.cursor="pointer";this.node.appendChild(link);};$prototype.displayHelp=function(){top.consoleRef=window.open('help.html','helpwindow','width=500,height=500,menubar=0,toolbar=0'+',status=0,scrollbars=1,resizable=1');};namespace("SLAMM.actions");$namespace.ResetAOITool=Class.create(userSmarts.maps.tools.Tool);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{id:'reset'});superClass.call(this,properties);var box=new Geometry("Box");box.addPoint(new Point(-85.75,30.50));box.addPoint(new Point(-78.50,35.50));this.defaultView=box;};$prototype.paint=function(){var icon=this.factory.create('resettool','resettool-selected','Return to study region extent',"image.map.aoi.reset");connect(icon,'onclick',this,this.resetAOI);this.icon=icon;return this.icon;};$prototype.resetAOI=function(){if(!this.adapter){logError("No adapter for tool");return false;}
var widget=this.adapter.getProperty("widget");var context=widget.context;context.setView(this.defaultView);};$prototype.about=function(){var title=SPAN({'class':'map-tool-title'},'Return to Study Region Extent : ');var text=document.createTextNode('Clicking this tool causes the map to zoom back to the full extent of '+'the study region, the initial condition when the application was started.');var holder=DIV({'class':'map-tool-about'},title,text);return holder;};$prototype.dispose=function(){disposeImage(this.icon);userSmarts.maps.tools.Tool.prototype.dispose.call(this);};namespace("SLAMM.actions");$namespace.ZoomAction=Class.create(userSmarts.wt.action.Action);$prototype.initialize=function(superClass,properties){properties=setdefault(properties,{text:'Zoom',toolTipText:'Zoom to Selected Region',image:'image.map.tool.zoom.box'});superClass.call(this,properties);var ps=userSmarts.runtime.Platform.getPropertyService();ps.connect("slamm.region","selected",this,this.onSelectionChange);};$prototype.run=function(){var ps=userSmarts.runtime.Platform.getPropertyService();var extent=ps.getProperty("slamm.region","selected");if(extent){SLAMM.Plugin.getDefault().controller.setExtent(extent);}};$prototype.onSelectionChange=function(event){if(event.newValue){this.setEnabled(true);}else{this.setEnabled(false);}};