<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" width="240" height="480" creationComplete="init(event)" xmlns:view="com.view.*"
			   close="windowCloseHandler(event)" title="安全系统图层" skinClass="com.skins.common.CxTitleWindow" windowMove="windowMoveFunction(event)" xmlns:tree="com.tree.*">
	<s:layout>
		<s:VerticalLayout/>
	</s:layout>
	<fx:Script>
		<![CDATA[
			import com.tcb.ConvertListToXML;
			import com.xt.hb.utils.RemoteUtils;
			
			import mx.binding.utils.BindingUtils;
			import mx.collections.ArrayCollection;
			import mx.events.CloseEvent;
			import mx.events.FlexEvent;
			import mx.managers.PopUpManager;
			import mx.rpc.events.AbstractEvent;
			import mx.rpc.events.FaultEvent;
			import mx.rpc.events.ResultEvent;
			[Bindable]
			public var menuXML:XML = null;
			public var  checkBoxClickHandler:Function = null;
			protected function windowCloseHandler(event:CloseEvent):void
			{
				PopUpManager.removePopUp(this);
			}
			protected function init(event:FlexEvent):void
			{
//				RemoteUtils.callRemote("mapConfigCtl","queryMapList",function(e:AbstractEvent):void{
//					if(e is FaultEvent){
//						trace("error");
//					}else {
//						var tcArr:ArrayCollection = ResultEvent(e).result as ArrayCollection;
//						menuXML= new ConvertListToXML().getXMLByList(tcArr,"id","fid","ALL");
//					}
//				});
//				var arr:ArrayCollection = new ArrayCollection([
//					{CDMC:"图层控制",id:"i1" ,fid:"f1" ,CDTB:"flexResources/homePage/tab/tabicon_42.png" ,STATE:"1" ,CDID:"M_ZYZS_TCKZ"},
//					{CDMC:"港区",id:"i2" ,fid:"i1" ,CDTB:"flexResources/tuli/GQ.png" ,STATE:"1" ,CDID:"L_ID_GQ"},
//					{CDMC:"作业区",id:"i3" ,fid:"i1" ,CDTB:"flexResources/tuli/GQ.png" ,STATE:"1" ,CDID:"L_ID_ZYQ"},
//					{CDMC:"现状锚地",id:"i4" ,fid:"i1" ,CDTB:"flexResources/tuli/GQ.png" ,STATE:"1" ,CDID:"L_ID_MD_XZ01"},
//					{CDMC:"规划锚地",id:"i5" ,fid:"i1" ,CDTB:"flexResources/tuli/GQ.png" ,STATE:"0" ,CDID:"L_ID_MD_GH01"},
//					{CDMC:"码头",id:"i6" ,fid:"i1" ,CDTB:"flexResources/tuli/GQ.png" ,STATE:"1" ,CDID:"L_ID_MT01"},
//					{CDMC:"泊位",id:"i7" ,fid:"i1" ,CDTB:"flexResources/tuli/GQ.png" ,STATE:"1" ,CDID:"L_ID_BW01"},
//					{CDMC:"港口经营人",id:"i8" ,fid:"i1" ,CDTB:"flexResources/tuli/GQ.png" ,STATE:"1" ,CDID:"L_ID_GKJYR"},
//					{CDMC:"岸线",id:"i9" ,fid:"i1" ,CDTB:"flexResources/tuli/GQ.png" ,STATE:"0" ,CDID:"L_ID_AX_XZ"} 
//				]);
//				menuXML= new ConvertListToXML().getXMLByList(arr,"id","fid","f1");
			}
			protected function fieldTypeLabel(item:Object):String
			{
				if(null != item){
					return resourceManager.getString('select',item.@localeName);
				}
				return "";
			}
			private function windowMoveFunction(event:Event):void
			{
				event.target.x = event.target.x < 0 ? 0 : event.target.x;
				event.target.x = event.target.x + event.target.width > event.target.parent.width ? event.target.parent.width - event.target.width : event.target.x;
				event.target.y = event.target.y < 0 ? 0 : event.target.y;
				event.target.y = event.target.y + event.target.height > event.target.parent.height ? event.target.parent.height - event.target.height : event.target.y;
			}
			private function checkBox_click(event:Event):void
			{
				if(null != checkBoxClickHandler)
				{
					checkBoxClickHandler(event);
				}
				//menuTree.selectedItem;
				//BaseEventDispatcher.getInstance().dispatchEvent(new TCKZCheckBoxClickEvent(TCKZCheckBoxClickEvent.TCKZ_TreeNodeCheckBox_Click,event.currentTarget));
			}
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:BorderContainer  width="100%" height="100%" borderColor="#6b9ca5" borderWeight="3" cornerRadius="5">
		<tree:CheckLegendTree id="menuTree" width="100%" height="100%" borderVisible="false"
							  defaultLeafIcon="{null}" disclosureClosedIcon="{null}" disclosureOpenIcon="{null}"
							  dataProvider="{this.menuXML}" legendHeight="28" legendWidth="28" 
							  labelField="@cdmc" legendField="@cdtb" checkBoxStateField="@checkState" legendType="ICON"
							  itemClick="checkBox_click(event)" showRoot="false"/>
	</s:BorderContainer>
</s:TitleWindow>
