//My Add //===================================================================== //Get Widget and return it to calling function //===================================================================== public function getWidget(id:Number):IBaseWidget { var idx:Object = configData.widgetIndex[id]; var wgtContainer:IWidgetContainer = configData.widgetContainers[idx.container].container.obj; var wgt:Object = configData.widgetContainers[idx.container].widgets[idx.widget]; var preload:String = wgt.preload; var label:String = wgt.label; var icon:String = wgt.icon; var config:String = wgt.config; var url:String = wgt.url; var headless:String = wgt.headless; var wx:Number = Number(wgt.x); var wy:Number = Number(wgt.y); var wleft:String = wgt.left; var wtop:String = wgt.top; var wright:String = wgt.right; var wbottom:String = wgt.bottom; //widget loaded var widget:IBaseWidget; if (widgetTable.containsKey(id)) { widget = widgetTable.find(id) as IBaseWidget; //add back the container if exists widget.setState(BaseWidget.WIDGET_OPENED); wgtContainer.focusWidget(id); } else { //module loaded if (moduleTable.containsKey(url)) { var modInfo:IModuleInfo = moduleTable.find(url) as IModuleInfo; widget = modInfo.factory.create() as IBaseWidget; widget.widgetId = id; widget.widgetTitle = label; widget.widgetIcon = icon; widget.config = config; widget.configData = configData; widget.map = map; widget.isDraggable = this.isDraggable; widget.isResizeable = this.isResizeable; widget.setPreload(preload); // if no X and Y both configured, use system X/Y for positioning if (wleft||wtop||wright||wbottom) { widget.setRelativePosition(wleft,wright,wtop,wbottom); } else if (wx && wy) { widget.setXYPosition(wx,wy); } else { setAutoXY(); wx = _refX; wy = _refY widget.setXYPosition(wx, wy); } wgtContainer.addWidget(widget); if (preload) widget.setState(preload); else widget.setState(BaseWidget.WIDGET_OPENED); widgetTable.add(id, widget); } else { loadWidget(id); } } return widget; } //End My Add
ViewerContainer.getInstance().widgetManager.getWidget(id)
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.