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;		
    		}
    	}
    }
    
  • 相关阅读:
    css flex布局应用
    Java 中 List、HashTable、HashMap、TreeMap
    Java 面向对象的三大特征
    Java-冒泡排序算法
    单例模式- 实现方式
    Mac
    Appium DesiredCapabilities 参数设置
    Mac- appium 环境配置
    PHP安装+使用
    mac 安装protobuf,并编译
  • 原文地址:https://www.cnblogs.com/warrior/p/1905289.html
Copyright © 2011-2022 走看看