JFace TableViewer - 根据其他单元格设置单元格格式
我有一个 JFace TableViewer。一列中的值通常应该是唯一的,但在某些情况下,它们不是唯一的(例如,当复制一行但尚未更改时)。但是,我想通过突出显示该列中包含重复值的行来提醒用户重复值。最好的方法是什么? LabelProvider 似乎只允许我访问当前单元格或最多当前行。
谢谢, 托马斯
I have a JFace TableViewer. The values in one column should normally be unique, but there are cases where it makes sense that they are not (e.g. when a row was copied and not yet changed). However I want to alert the user of the duplicate values by highlighting the rows which contain duplicate values in that column. What's the best way to do this? The LabelProvider seems to only give me access to the current cell or at most the current row.
Thanks,
Thomas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要检测整个表中的重复项,我想您必须拥有某种包含所有单元格数据的地图或集合。我所做的方法是将这样的地图放入视图(TableViewer 容器)中,然后让标签提供程序保存到该视图的链接(因此是地图)。因此,从标签提供商内部,它能够检测重复并做出相应的响应。
To detect duplicate across the whole table, I guess you got to have some kind of map or set containing all the cell's data. The way I did was to put such map in the view (TableViewer container) and then have label provider holding a link to that view (hence the map). So from within label provider, it is able to detect duplicate and respond accordingly.