zoukankan      html  css  js  c++  java
  • 自定义AdvancedDataGrid的groupItemRenderer

    package AddrList
    {
    	import flash.events.Event;
    	import flash.events.MouseEvent;
    	
    	import mx.collections.ArrayCollection;
    	import mx.controls.AdvancedDataGrid;
    	import mx.controls.CheckBox;
    	import mx.controls.advancedDataGridClasses.AdvancedDataGridGroupItemRenderer;
    
    	public class AdvancedDataGridGroupItemRendererEx extends AdvancedDataGridGroupItemRenderer
    	{
    		private var checkBox : CheckBox;
    		
    		public function AdvancedDataGridGroupItemRendererEx()
    		{
    			super();
    		}
    
    		override protected function createChildren():void
    		{
    			super.createChildren();
    			checkBox=new CheckBox();
    			checkBox.addEventListener(MouseEvent.CLICK,onChange);
    			checkBox.x = 4;
    			checkBox.y=label.y + 8;
    			addChild(checkBox);
    		}
    		
    		protected function onChange(e:MouseEvent):void 
    		{
    			e.stopPropagation();
    			var cbx:CheckBox = e.currentTarget as CheckBox;
    			var a:ArrayCollection = this.data.children as ArrayCollection;
    			for(var i:int =0;i<a.length;i++)
    			{
    				a[i].checked = cbx.selected;
    			}
    			data.selectedState = cbx.selected;
    			var d:AdvancedDataGrid = this.owner as AdvancedDataGrid;
    			d.invalidateList();
    		}
    
    		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    		{
    			super.updateDisplayList(unscaledWidth, unscaledHeight);
    			if (disclosureIcon)
    			{
    				disclosureIcon.x=disclosureIcon.x + 20;
    			}
    			if (icon)
    			{
    				icon.x=icon.x + 20;
    			}
    			label.x=label.x + 20;
    			checkBox.selected = data.selectedState;		
    		}
    	}
    }
    
  • 相关阅读:
    2012 Multi-University #8
    2016"百度之星"
    Codeforces Round #352 (Div. 2)
    数位DP CF 55D Beautiful numbers
    数位DP GYM 100827 E Hill Number
    2012 Multi-University #9
    2012 Multi-University #10
    java生成指定范围的随机数
    MySql查询时间段的方法
    eclipse报错GC overhead limit exceed,卡顿
  • 原文地址:https://www.cnblogs.com/warrior/p/1905289.html
Copyright © 2011-2022 走看看