简体   繁体   English

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

[英]A more advanced table/spreadsheet SWT implementation

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. 我正在开发一个基于Eclipse的富客户端平台的应用程序,该应用程序在很大程度上依赖于使用表来显示和编辑数据。 I'm currently using the SWT implementations of Table and TableViewer. 我目前正在使用Table和TableViewer的SWT实现。

My users are forever complaining that it "doesn't work like in excel". 我的用户永远抱怨它“不像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. 我正在寻找解决这些问题的实现。

Criteria: 标准:

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

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? 我当然会在这里寻找解决方案和报告,但你对这个问题有什么建议吗?

Check out the Nebula Grid component. 查看星云网格组件。 It's still being developed, so is not 100% mature, but seems to meet your needs. 它仍在开发中,因此不是100%成熟,但似乎满足您的需求。

I think SWT Matrix has 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. 它具有对称设计,因此行和列具有相同的表示,这意味着它们都可以被选择,移动,隐藏,调整大小等,就像在excel中一样。 Cell navigation and selection also is excel-like. 细胞导航和选择也很出色。 And all key and mouse gestures are bound to the same actions as in spreadshits. 并且所有键和鼠标手势都与spreadshits中的操作相同。

The component is closed source but free for private and non-commercial use. 该组件是封闭源,但可以免费用于私人和非商业用途。 Still alpha stage at this point, though. 不过,此时仍处于alpha阶段。

KTable is mature and very customizable. KTable成熟且可定制。 I used it to provide a very excel-like experience for my SWT app. 我用它来为我的SWT应用程序提供非常好的体验。

NatTable is free, fast and powerful. NatTable是免费的,快速的和强大的。

Since this question was first asked, it has become part of the Eclipse Nebula project. 自从这个问题首次提出以来,它已成为Eclipse星云项目的一部分。 Development is still active. 发展仍然活跃。

The API is huge. API非常庞大。 A huge set of examples provide simple sample code to get started. 一组大量示例提供了简单的示例代码以便入门。

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. 要复制,导出到Excel和打印的标准操作。
  • Validation and visual indication of invalid values 无效值的验证和可视指示
  • Multi-cell editing 多单元格编辑
  • Cell decorators 细胞装饰者
  • Persist state of column sizing, order, hiding, sorting, etc. 列大小,顺序,隐藏,排序等的持续状态

Run the examples to see the speed and power. 运行示例以查看速度和功率。 Be aware that you must add the SWT plugin to your classpath. 请注意,您必须将SWT插件添加到类路径中。 The examples don't include it. 示例不包括它。 Here's an example: 这是一个例子:

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. [感谢前几年的海报提及NatTable。 This answer provides an update and more information.] 这个答案提供了更新和更多信息。]

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

I've been using the Nebula Grid component, 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. 您可以拥有列标题和行标题,列组,自定义单元格渲染器等。

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. 我最近遇到的问题是要正确计算线高,并且看起来现在没有太多活跃的开发,所以我将尝试自己修复它。

KTable is similar to JTable. KTable类似于JTable。

Nebula Grid fits in well with the Widget + Viewer paradigm. 星云网格与Widget + Viewer范例非常吻合。 I was able to migrate from normal SWT table to this in a matter of minutes. 我能够在几分钟内从普通的SWT表迁移到此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM