<?xml version="1.0" encoding="utf-8"?>
<mx:CheckBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()"
	keyDown="IME.enabled = false" focusOut="IME.enabled = true">
	<mx:Script>
        <![CDATA[
        	import mx.events.DataGridEvent;
            import mx.events.FlexEvent;
            import mx.controls.dataGridClasses.DataGridListData;
			import cls.com.ils.biz.model.enum.*;
            
            private var _ownerData:Object;
            private var _text:String;
            
			private function onCreationComplete():void
			{
			}

            override public function set data(value:Object):void
            {
                _ownerData = value;
                
                if(_ownerData){
                    var col:DataGridListData = DataGridListData(listData);
                    selected = (_ownerData[col.dataField] == "1") ? true : false;
                    
                    updateDummyText();
                    dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
                }
            }
            
            override public function get data():Object
            {
                return _ownerData;
            }
            
            override protected function clickHandler(event:MouseEvent):void
            {
            	if(this.enabled==true){
            		//使用可能の場合
	                super.clickHandler(event);
	                
	                var col:DataGridListData = DataGridListData(listData);
	                _ownerData[col.dataField] = selected ? "1" : "0";
	                
	                updateDummyText();                
            	}
            }

            //これがないとダメ！！
            public function set text(value:String):void
            {
                //
            }
            
            //これがないとダメ！！
            public function get text():String
            {
                return _text;
            }

            private function updateDummyText():void
            {
                if(selected){
                    _text = "1";
                }else{
                    _text = "0";
                }
            }
                        
//			private function onFocusIn(event:FocusEvent):void{
//				IME.enabled = false;
//		        var parent:Object = event.currentTarget.parentDocument;
//		        if (parent is AppPanel)
//		        {
//					//使用不可
//					parent.zoomEnabled = false;
//		            return;
//		        }
//			}

        ]]>
    </mx:Script>	
</mx:CheckBox>
