Flex 优化Renderer(不使用HGroup)
程序员文章站
2022-06-11 08:51:25
...
package
{
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.controls.listClasses.IDropInListItemRenderer;
import mx.controls.listClasses.IListItemRenderer;
import mx.core.UIComponent;
import mx.events.FlexEvent;
public class BaseRenderer extends UIComponent implements Tabable, IListItemRenderer, IDropInListItemRenderer
{
private var _dataIndex:int=-1;
private var _listData:DataGridListData;
private var _data:Object;
public function BaseRenderer()
{
super();
}
public function get dataIndex():int
{
return _dataIndex;
}
public function set dataIndex(value:int):void
{
_dataIndex=value;
}
[Bindable("dataChange")]
public function get data():Object
{
return _data;
}
public function get listData():BaseListData
{
return _listData;
}
public function set listData(value:BaseListData):void
{
_listData=DataGridListData(value);
}
public function set data(value:Object):void
{
_data=value;
this.dataIndex=(listData.owner).dataProvider.getItemIndex(data);
this.invalidateProperties();
dispatchEvent(new FlexEvent("dataChange"));
}
override protected function createChildren():void
{
super.createChildren();
}
override protected function commitProperties():void
{
super.commitProperties();
updateRenderer();
}
override protected function measure():void
{
super.measure();
// this.measuredHeight=22;
}
protected function updateRenderer():void
{
}
public function get text():Object
{
return "";
}
public function getFocusable():UIComponent
{
return null;
}
/**
* initialize a new instance
*/
public function newInstance():*
{
return new BaseRenderer();
}
}
}
上一篇: unity android 微信登录分享