如果你的列表中要用到过多的ItemRender才能实现您要的效果,那最好不要直接从某容器实现,加载的速度那是相当另人不爽的。因此有必要自己手动来写一个从UIComponent继承而来的组件。参考的文档最好的应该是Adobe开发人员中心的文章了: 理解 Flex itemRenderer
这里写个大概流程代码,以供备忘
package renderer
{
import mx.controls.AdvancedDataGrid;
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 ExampleItemRenderer extends UIComponent implements IListItemRenderer, IDropInListItemRenderer
{
public function ExampleItemRenderer()
{
super();
}
/*
* 创建子组件,并设置样式及可见性等
*/
override protected function createChildren():void
{
//trace("createChildren");
super.createChildren();
// 增加子组件
}
private var _data:Object;
[Bindable("dataChange")]
public function get data():Object
{
return _data;
}
/*
* 在这个方法中调用invalidateProperties(),是为了在适当的时候调用commitProperties()
* 进行数据显示设置以及组件的可见性。
* 派发事件,并由get data()监听,是为了数据源的绑定。
*/
public function set data(value:Object):void
{
//trace("setData");
_data=value;
invalidateProperties();
dispatchEvent(new FlexEvent("dataChange"));
}
/*
* 在这个方法中进行数据设置。当然,也可以在set data()中进行,不过可能会有不妥的时候吧
*/
override protected function commitProperties():void
{
//trace("commitProperties");
super.commitProperties();
// 获取列设置信息
var field:String = (listData as DataGridListData).dataField;
// lbl.text = data[field];
}
/*
* 在这个方法中对子元素进行定位和设置大小,默认大小为0×0
*/
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
//trace("updateDisplayList");
super.updateDisplayList(unscaledWidth, unscaledHeight);
//lbl.move(0, 0);
//lbl.setActualSize(unscaledWidth, unscaledHeight);
}
/*
*
*/
override protected function measure():void
{
//trace("measure");
super.measure();
// 如果AdvancedDataGrid的variableRowHeight="true"应该实现该方法,以提供合适的宽高
}
private var _listData:BaseListData;
public function get listData():BaseListData
{
return _listData;
}
public function set listData(value:BaseListData):void
{
_listData=value;
}
}
}
分享到:
相关推荐
UIComponent.unitypackage
UIComponent
保留了 UICONTROL 的调用约定和语法以实现完全向后兼容性。 UICOMPONENT 尽可能使用内置的 UICONTROL(即,用于所有标准样式),并使用 JAVACOMPONENT 创建和显示所有其他 java 类。 UICOMPONENT 以几种等效的不...
MatlabGUI使用java组件无所不能-uicomponent.m 是不是曾经想做出漂亮的GUI 界面? 是不是曾经想在 Matlab GUI里面显示网页? 看看这个界面: matlab_java.png 所以,...
This is a Flex UIComponent that can be used 谋n a FLEX 3 mxml application as component written in action script 3.0, provides you to create items that cab be filled from an XML or Query ResultSet or ...
继承于ConstraintLayout EmptyView 空数据视图-(图标加文字描述) 属性表格 name format description empty_title string 空视图提示文字(例如:暂无数据) empty_icon reference 空视图提示图标 empty_icon_width...
BlurryLoading-UiComponent
flex开发自定义控件
在用 ActionScript 创建自定义组件时,必须重载 UIComponent 类的一些方法.实现基本的 组件结构,构造器,以及 createChildren(),commitProperties(), measure(), layoutChrome() 和 updateDisplayList()方法.
实现了 标题,内容和按钮设置,可动态设置按钮,以及按钮点击事件的回调 可作为component 使用 ...viewclass="uiComponent uiComponent_mask uiComponent_mask_{{uiComponent.mask.show &&'active'}}
与 Tiles 相比,Facelets 的优势在于它预先集成了 JSF UIComponent,并且不需要 Facelets 配置文件,而 Tiles 需要 Tiles 配置文件。 在 Facelets 中可以添加 JSF 验证器和转换器。Facelets 全面支持表达式语言 (EL...
与asp js交互数据实现 ------------------------------ import fl.controls.Button; import fl.core.UIComponent; var TF : TextFormat = new TextFormat(); TF.size = 16; TF.color = 0x0000ff; key.setStyle(...
RadioButtons继承自UIControl,因此您可以轻松地对其进行管理。 支持2种样式: standard -类似于UITableView纯样式和grouped -类似于UITableView insertGrouped样式 垂直和水平放置。 按颜色类型的属性,缩进也可以...
对于服务器上定义的每个组件,我们在应用程序(UIComponent)中都有一个相应的UI实现。 考虑像Hotstar这样的娱乐应用程序,其合同定义如下。 左边是服务器中的组件( ServerComponent ),右边是相应的UI组件。在职...
React过度 一个使用Dart构建静态类型的React UI组件的库。 该库还公开了OverReact Redux ,它具有。... 查看《 UiComponent2迁移指南》以了解UiComponent2的优势,可以运行的codemod脚本以及可能需要手动进行的其他
在Page顶部下滑一个提示条 , 代码见 /mixins/UIComponent.js ,其中的self 可以认为是微信小程序的Page对象 (此图片来源于网络,如有侵权,请联系删除! ) 效果: 默认2秒展示,上移动画隐藏 /** * 展示顶部 tip , 多...
从您的ILIAS根目录开始 mkdir -p Customizing/global/plugins/Services/UIComponent/UserInterfaceHook cd Customizing/global/plugins/Services/UIComponent/UserInterfaceHook git clone ...
从您的ILIAS根目录开始 mkdir -p Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/ cd Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/ git clone ...