eclipse 更高级的表格/电子表格 SWT 实现

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/115766/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:19:11  来源:igfitidea点击:

A more advanced table/spreadsheet SWT implementation

javaeclipseswtspreadsheet

提问by Tirno

I'm developing an application based on Eclipse's Rich Client Platform that relies heavily on the use of tables for showing and editing data. I'm currently using the SWT implementations of Table and TableViewer.

我正在开发一个基于 Eclipse 的富客户端平台的应用程序,该平台在很大程度上依赖于使用表格来显示和编辑数据。我目前正在使用 Table 和 TableViewer 的 SWT 实现。

My users are forever complaining that it "doesn't work like in excel". Most notably, I can't select a single cell within a row and all rows have the same height. I'm looking for an implementation that addresses these issues.

我的用户总是抱怨它“不像在 excel 中那样工作”。最值得注意的是,我无法选择一行中的单个单元格,并且所有行都具有相同的高度。我正在寻找解决这些问题的实现。

Criteria:

标准:

  • Free (as in speech andbeer -- I'm a phd student and the program is EPL)
  • SWT (the various solutions for including swing in SWT aren't very nice)
  • 免费(如演讲啤酒——我是一名博士生,课程是 EPL)
  • SWT(在SWT中包含swing的各种解决方案都不是很好)

Edit:

编辑:

So far I have the following suggestions:

到目前为止,我有以下建议:

Unfortunately, a cursory glance provides no information about the differences between these implementations. I'll of course be looking for solutions and report back here, but do you have any advice on the subject?

不幸的是,粗略地看一眼并没有提供有关这些实现之间差异的信息。我当然会寻找解决方案并在这里报告,但是您对这个主题有什么建议吗?

回答by Ben Hoffstein

Check out the Nebula Gridcomponent. It's still being developed, so is not 100% mature, but seems to meet your needs.

查看星云网格组件。它仍在开发中,所以不是 100% 成熟,但似乎可以满足您的需求。

回答by Jacek Ko?odziejczyk

I think SWT Matrixhas the features you're looking for.

我认为SWT Matrix具有您正在寻找的功能。

It has a symmetrical design thus the rows and columns have the same representation, which means they can all be selected, moved, hidden, resized, etc., like in excel. Cell navigation and selection also is excel-like. And all key and mouse gestures are bound to the same actions as in spreadshits.

它采用对称设计,因此行和列具有相同的表示形式,这意味着它们都可以像在 excel 中一样进行选择、移动、隐藏、调整大小等。单元格导航和选择也与 excel 类似。并且所有按键和鼠标手势都绑定到与spreadshit 中相同的操作。

The component is closed source but free for private and non-commercial use. Still alpha stage at this point, though.

该组件是封闭源代码,但可免费用于私人和非商业用途。不过,此时仍处于 alpha 阶段。

回答by Andy Thomas

NatTableis free, fast and powerful.

NatTable免费、快速且功能强大。

Since this question was first asked, it has become part of the Eclipse Nebula project. Development is still active.

自从这个问题第一次被问到,它就成为了 Eclipse Nebula 项目的一部分。发展仍然活跃。

The API is huge. A huge set of examples provide simple sample code to get started.

API 是巨大的。大量示例提供了入门的简单示例代码。

Some nice features:

一些不错的功能:

  • Can handle huge datasets without performance issues
  • Row headers
  • Spanning cells
  • Tree table
  • Cell editors: text, combo, checkbox
  • Standard actions to copy, export to Excel, and print.
  • Validation and visual indication of invalid values
  • Multi-cell editing
  • Cell decorators
  • Persist state of column sizing, order, hiding, sorting, etc.
  • 可以在没有性能问题的情况下处理庞大的数据集
  • 行标题
  • 跨越细胞
  • 树表
  • 单元格编辑器:文本、组合、复选框
  • 复制、导出到 Excel 和打印的标准操作。
  • 无效值的验证和视觉指示
  • 多单元格编辑
  • 单元格装饰器
  • 列大小、排序、隐藏、排序等的持久状态。

Run the examples to see the speed and power. Be aware that you must add the SWT plugin to your classpath. The examples don't include it. Here's an example:

运行示例以查看速度和功率。请注意,您必须将 SWT 插件添加到类路径中。示例不包括它。下面是一个例子:

C:> java -cp C:\eclipse\plugins\org.eclipse.swt.win32.win32.x86_VERSION.jar;NatTableExamples-0.9.0.jar org.eclipse.nebula.widgets.nattable.examples.NatTableExamples

C:> java -cp C:\eclipse\plugins\org.eclipse.swt.win32.win32.x86_ VERSION.jar;NatTableExamples-0.9.0.jar org.eclipse.nebula.widgets.nattable.examples.NatTableExamples

[Thanks to posters from prior years for mentioning NatTable. This answer provides an update and more information.]

[感谢前几年的海报提到 NatTable。这个答案提供了更新和更多信息。]

回答by Andy Thomas

NatTable is tended to provide a high performance and huge volume capability

NatTable 倾向于提供高性能和巨大的容量

回答by Mike Houston

I've been using the Nebula Gridcomponent, as previously mentioned, in a project at work, and in general I'd have to say I think it works pretty well. There are some performance issues, and it isn't quite finished, but it's pretty easy to bend to whatever shape you need, and does a good job of spreadsheet-style tables of data. You can have column and row headings, column groups, custom cell renderers, etc.

如前所述,我一直在工作中的项目中使用Nebula Grid组件,总的来说,我不得不说我认为它工作得很好。有一些性能问题,还没有完全完成,但是很容易弯曲成您需要的任何形状,并且在电子表格样式的数据表方面做得很好。您可以拥有列和行标题、列组、自定义单元格渲染器等。

My most recent problem with it is getting line heights to be calculated correctly, and it doesn't look like there's much active development happening at the moment, so I will be trying to fix it myself.

我最近遇到的问题是正确计算行高,目前看起来没有太多积极的发展,所以我将尝试自己修复它。

回答by Heath Borders

KTableis mature and very customizable. I used it to provide a very excel-like experience for my SWT app.

KTable是成熟的并且非常可定制的。我用它为我的 SWT 应用程序提供了非常类似于 excel 的体验。

回答by Tirno

KTable is similar to JTable.

KTable 类似于 JTable。

Nebula Grid fits in well with the Widget + Viewer paradigm. I was able to migrate from normal SWT table to this in a matter of minutes.

Nebula Grid 非常适合 Widget + Viewer 范式。我能够在几分钟内从普通的 SWT 表迁移到这个表。