JFace TableViewer - 根据其他单元格设置单元格格式

发布于 2024-08-15 18:27:12 字数 166 浏览 1 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安静 2024-08-22 18:27:12

要检测整个表中的重复项,我想您必须拥有某种包含所有单元格数据的地图或集合。我所做的方法是将这样的地图放入视图(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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文