Currently, I rework on my code , because I want to use MVC and JFace. Native SWT provides the possibility to add some Objects to a SWT-TableItem by using the function .setData(..):
目前,我重写了我的代码,因为我想使用MVC和JFace。 Native SWT提供了使用函数.setData(..)将一些对象添加到SWT-TableItem的可能性:
TableItem item = new TableItem(table, SWT.NONE, 1);
item.setData(someObject)
Is there a chance to do this in my new created Label- or ContentProviders?
有没有机会在我新创建的Label-或ContentProviders中执行此操作?
1 个解决方案
#1
TableViewer
(and other viewers) uses the item.setData(object)
method itself to associate your data model object with the item. Setting the data value to something else will break the viewer.
TableViewer(和其他查看器)使用item.setData(object)方法本身将数据模型对象与项关联。将数据值设置为其他内容将破坏查看器。
Also the viewer does not guarantee to use the same item for a particular row for the life time of the table. Operations such as refresh
may use new table items.
此外,观众不保证在表的生命周期中对特定行使用相同的项目。刷新等操作可能会使用新的表项。
#1
TableViewer
(and other viewers) uses the item.setData(object)
method itself to associate your data model object with the item. Setting the data value to something else will break the viewer.
TableViewer(和其他查看器)使用item.setData(object)方法本身将数据模型对象与项关联。将数据值设置为其他内容将破坏查看器。
Also the viewer does not guarantee to use the same item for a particular row for the life time of the table. Operations such as refresh
may use new table items.
此外,观众不保证在表的生命周期中对特定行使用相同的项目。刷新等操作可能会使用新的表项。